Вопрос

SharePoint 2010 - у меня стандартный список задач в GANTT View, который представляет собой список проектов (синхронизация от Project 2010).Поскольку ширина столбца не постояна в SharePoint, я написал скрипт для изменения ширины колонки (называемый «название»), но имея очень личья удача с ней.Я уверен, что у меня есть либо селекторный синтаксис, библиотека или проблема CEWP (и очевидный пробел знания).На странице я разместил CEWP и поместил следующую логику в эту часть:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">  

$(function()  
{  
   $(document).ready(function() {
    //Get the th that has a title attribute and it contains the value Title 
    $('th[title="Title"]').css("width", "450px","important");  
    });
});

ExecuteOrDelayUntilScriptLoaded(function()
{
var oldGanttControl = SP.GanttControl;
SP.GanttControl = function()
{
oldGanttControl.call(this);
var oldInit = this.Init;
this.Init = function(jsGridControl, jsRawGridData, params)
{
oldInit.call(this, jsGridControl, jsRawGridData, params);
DoCustomizations(jsGridControl);
};
};
},"SPGantt.js");


function DoCustomizations(grid)
{
// Set the Splitter and Zoom Levels
grid.SetSplitterPosition(725);
grid.SetGanttZoomLevel(grid.GetGanttZoomLevel()+2);
} 
</script> 
.

Селектор просто не будет держать на заголовке.Я попробовал ряд вариантов, чтобы попытаться использовать .cs, чтобы изменить ... Нет успешно

$("TH.ms-vh2-nograd:contains('Title')").css("width", "450px");  
$("TH.ms-vb:contains('Title')").css("width", "450px"); });  
$("tr.ms-viewheadertr th:contains('Title')").css("width", "450px");
$('th[title="Title"]').css("width", "450px","important");  
$('th[title="Title"]').css("width", "450px", "important"); 
$('th[title="Title"]').css('width', '450px', 'important'); 
$('th [title="Title"]').css("width", "450px", "important"); 
$("th [title='Title']").css("width", "450px", "important");
.

Любые идеи по способу изменить ширину столбца, может быть, я приближаюсь к этому неправильно?Сгенерированная логика HTML для этого управления находится в Pastbin Line 102 - это цель, ширина - это атрибут.

Спасибо заранее

Это было полезно?

Решение

can you refer to this as someone has kinds answered it for you! you just need to tweak the answer to suit your needs :) , the answer is by "Tanisha Rowe":

<script type="text/javascript"
src="ajax.googleapis.com/.../jquery.min.js"></script>
<script type="text/javascript">
$(function(){

$("table[name=Category]").css("width","300px");

});
</script>

its getting the table and getting the colum category and changing the css width to 300px so you need to change it slightly! Id recommend you go on the link and see her reply as its in more detail!

http://www.go4sharepoint.com/Forum/change-width-column-10948.aspx

hope this helps :)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top