使用 Internet Explorer 的 Sharepoint 下拉列表无法正确显示超过 20 个项目

标签 sharepoint drop-down-menu internet-explorer-9

我在我的三个共享点网站上遇到了这个问题,我通过修改其中两个网站的 CSS 代码 (cf http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/64796605-bcbb-4a87-9d8d-9d609579577f/) 设法解决了这个问题。

我不知道为什么这不适用于我的第三个具有相同更新、相同 CSS 和相同 html 代码的第三个... 我尝试了几种解决方案,例如添加 indesign="true"(这不能使用,因为列表超过 75 列)。比照 http://www.codeproject.com/Articles/194254/Advanced-fixing-SharePoint-2010-large-lookup-dropd

我找到的唯一解决方案需要 javascript,但我真的不想使用它...

如果有人提出其他解决方案,我将不胜感激。

编辑: 多亏了 moontear,我发现了一些很棒的东西。 我将脚本的开头替换为: $(文档).ready(函数(){

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

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

通过这种方式,我只需要包含脚本而不用关心哪些列有问题...

最佳答案

这个脚本似乎很适合解决这个问题...... 谢谢你的评论 原脚本来自: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
});

关于使用 Internet Explorer 的 Sharepoint 下拉列表无法正确显示超过 20 个项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11416099/

相关文章:

sharepoint - 什么是 Microsoft SharePoint?

php - PHP 脚本中的 HTML 复选框和 Mysql

javascript - 如何从下拉列表中选择的值填充 javascript 数组?

css - 网站在 IE9/Comino 和 iPad/iPhone 浏览器中无法正确呈现 - 侧边栏掉到底部,在内容下方

javascript - 使用 Visual Studio 2010 时禁用 IE9 Javascript 调试器

javascript - IE9 onclick Bug?

javascript - SharePoint 2010 和 "get_groups"方法

c# - 将 ValidationGroup 与 Sharepoint EditorPart 结合使用

excel - 使用 vba-excel 从共享点下载整个目录(文件夹)

css - 我的下拉菜单在我点击之前就消失了