2012-07-10 56 views
3

我有這個問題在我的三個SharePoint站點上,我設法通過修改其中兩個CSS代碼(比較http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/64796605-bcbb-4a87-9d8d-9d609579577f/)解決此問題。Sharepoint下拉列表無法正確顯示超過20項與Internet Explorer

我不知道爲什麼這不起作用,我的第三個具有相同的更新,相同的CSS和相同的HTML代碼... 我嘗試了幾個解決方案,如添加indesign =「true」(這可以'因爲列表超過了75列)。 CF http://www.codeproject.com/Articles/194254/Advanced-fixing-SharePoint-2010-large-lookup-dropd

我發現的唯一的解決方案需要的JavaScript,但我真的不希望使用它...

如果某人有另一種解決方案提出,我會很感激。

編輯: 感謝moontear我發現了一些相當不錯的東西。 我更換劇本由開頭: $(文件)。就緒(函數(){

$('.ms-lookuptypeintextbox').each(function(){ 
    OverrideDropDownList($(this).attr('title')); 
}); 

// Main Function 
function OverrideDropDownList(columnName) { 
... 

通過這種方式,我必須包括腳本和不關心哪些列有問題...

+0

你嘗試過使用jQuery的呢? http://sharepointegg.blogspot.de/2010/10/fixing-sharepoint-2010-lookup-drop-down.html – 2012-07-10 15:43:21

+0

哦,是的!這工作,但沒有辦法有一個全球性的解決方案,而不是修改每個列表表單?謝謝你的回答 – 2012-07-11 07:48:23

回答

2

這個腳本似乎是相當巨大的,解決這個問題... 謝謝moontear的評論 原劇本來自:http://sharepointegg.blogspot.de/2010/10/fixing-sharepoint-2010-lookup-drop-down.html

$(document).ready(function() { 

$('.ms-lookuptypeintextbox').each(function(){ 
    OverrideDropDownList($(this).attr('title')); 
}); 

// Main Function 
function OverrideDropDownList(columnName) { 

// Construct a drop down list object 
var lookupDDL = new DropDownList(columnName); 

// Do this only in complex mode... 
if (lookupDDL.Type == "C") { 

// Hide the text box and drop down arrow 
lookupDDL.Obj.css('display', 'none'); 
lookupDDL.Obj.next("img").css('display', 'none'); 

// Construct the simple drop down field with change trigger 
var tempDDLName = "tempDDLName_" + columnName; 
if (lookupDDL.Obj.parent().find("select[ID='" + tempDDLName + "']").length == 0) { 
lookupDDL.Obj.parent().append("<select name='" + tempDDLName + "' id='" + tempDDLName + "' title='" + tempDDLName + "'></select>"); 

lookupDDL.Obj.parent().find("select[ID='" + tempDDLName + "']").bind("change", function() { 
updateOriginalField(columnName, tempDDLName); 
}); 
} 

// Get all the options 
var splittedChoices = lookupDDL.Obj.attr('choices').split("|"); 

// get selected value 
var hiddenVal = $('input[name=' + lookupDDL.Obj.attr("optHid") + ']').val(); 
if (hiddenVal == "0") { 
hiddenVal = lookupDDL.Obj.attr("value") 
} 

// Replacing the drop down object with the simple drop down list 
lookupDDL = new DropDownList(tempDDLName); 

// Populate the drop down list 
for (var i = 0; i < splittedChoices.length; i++) { 
var optionVal = splittedChoices[i]; 
i++; 
var optionId = splittedChoices[i]; 

var selected = (optionId == hiddenVal) ? " selected='selected'" : ""; 
lookupDDL.Obj.append("<option" + selected + " value='" + optionId + "'>" + optionVal + "</option>"); 
} 
} 
} 

// method to update the original and hidden field. 
function updateOriginalField(child, temp) { 
var childSelect = new DropDownList(child); 
var tempSelect = new DropDownList(temp); 

// Set the text box 
childSelect.Obj.attr("value", tempSelect.Obj.find("option:selected").val()); 

// Get Hidden ID 
var hiddenId = childSelect.Obj.attr("optHid"); 

// Update the hidden variable 
$('input[name=' + hiddenId + ']').val(tempSelect.Obj.find("option:selected").val()); 
} 

// just to construct a drop down box object. Idea token from SPServces 
function DropDownList(colName) { 
// Simple - when they are less than 20 items 
if ((this.Obj = $("select[Title='" + colName + "']")).html() != null) { 
this.Type = "S"; 
// Compound - when they are more than 20 items 
} else if ((this.Obj = $("input[Title='" + colName + "']")).html() != null) { 
this.Type = "C"; 
// Multi-select: This will find the multi-select column control on English and most other languages sites where the Title looks like 'Column Name possible values' 
} else if ((this.Obj = $("select[ID$='SelectCandidate'][Title^='" + colName + " ']")).html() != null) { 
this.Type = "M"; 
// Multi-select: This will find the multi-select column control on a Russian site (and perhaps others) where the Title looks like '????????? ????????: Column Name' 
} else if ((this.Obj = $("select[ID$='SelectCandidate'][Title$=': " + colName + "']")).html() != null) { 
this.Type = "M"; 
} else 
this.Type = null; 
} // End of function dropdownCtl 
}); 
相關問題