我在jquery中创建了一个Kendo Grid,其中有大量的列假设为50.最初只有10个可见,最终用户可以通过列菜单看到其他列。
问题:
如果列数太大,就像我的情况一样,列菜单中的列窗口变得太大。我想要的是在其中加入一个滚动。
下面我展示了图片:
Jquery的:
//Creating Kendo Grid For Tasks
divSearchGrid.kendoGrid({
dataSource: {
transport: {
read: function (options) {
$.ajax({
type: "POST",
url: urlSearch,
data: paramsSearch,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
var data = result.d;
if (data != null) {
if (data.length > 0) {
orignalComplexData = data;
structuredData = [];
for (var i = 0; i < data.length; i++) {
var checkExistance = '';
var objStructured = {};
objStructured['StatusID'] = 1;
objStructured['AttID'] = 1;
objStructured['ServiceDefautltSRSubject'] = data[i].ServiceDefautltSRSubject;
objStructured['IsDescriptionEditable'] = data[i].IsDescriptionEditable;
objStructured['RecordStatusID'] = data[i].RecordStatusID;
objStructured['TaskOrder'] = data[i].TaskOrder;
objStructured[defaultTaskColumnAray[0]] = data[i].ServiceRequestID;
objStructured[defaultTaskColumnAray[1]] = data[i].TaskID;
objStructured[defaultTaskColumnAray[2]] = data[i].TaskDescription;
objStructured[defaultTaskColumnAray[3]] = data[i].FolderDescription;
objStructured[defaultTaskColumnAray[4]] = data[i].FolderSubject;
objStructured[defaultTaskColumnAray[5]] = data[i].AssignedToName;
objStructured[defaultTaskColumnAray[6]] = data[i].StatusName;
objStructured[defaultTaskColumnAray[7]] = data[i].ServiceName;
objStructured['NavigateURI'] = data[i].NavigateURI;
objStructured['SRNavigateURI'] = data[i].SRNavigateURI;
objStructured['NavigateURIPSRID'] = data[i].NavigateURIPSRID;
objStructured['StatusIconpath'] = data[i].StatusIconPath;
objStructured['RecordStatusIcon'] = data[i].RecordStatusIcon;
if (data[i].PSRID != 0) {
objStructured[defaultTaskColumnAray[8]] = data[i].PSRID;
}
else {
objStructured[defaultTaskColumnAray[8]] = '';
}
objStructured[defaultTaskColumnAray[9]] = data[i].PSRSubject
var customFieldList = data[i].RecordStatusToolTip.split('%');
if (selectedFolderType != '' || defaultServiceGUID != '') {
for (var j = 0; j < customFieldList.length; j++) {
var fieldIndex = $.inArray(customFieldList[j].split('||')[0], checkExistance.split(','));
if (fieldIndex == -1) {
if (customFieldList[j].split('||')[2] == '5' || customFieldList[j].split('||')[2] == '6') {
if (customFieldList[j].split('||')[1] == 'true') {
objStructured[customFieldList[j].split('||')[0]] = true;
}
else {
objStructured[customFieldList[j].split('||')[0]] = false;
}
}
else if (customFieldList[j].split('||')[2] == '7') {
if (customFieldList[j].split('||')[1] != '') {
if (new Date(customFieldList[j].split('||')[1]) != 'Invalid Date') {
objStructured[customFieldList[j].split('||')[0]] = customFieldList[j].split('||')[1];
}
else {
objStructured[customFieldList[j].split('||')[0]] = customFieldList[j].split('||')[1].split('/')[1] + '/' + customFieldList[j].split('||')[1].split('/')[0] + '/' + customFieldList[j].split('||')[1].split('/')[2];
}
}
else {
if (new Date(customFieldList[j].split('||')[4]) != 'Invalid Date') {
objStructured[customFieldList[j].split('||')[0]] = new Date(customFieldList[j].split('||')[4]);
}
else {
objStructured[customFieldList[j].split('||')[0]] = customFieldList[j].split('||')[4].split('/')[1] + '/' + customFieldList[j].split('||')[4].split('/')[0] + '/' + customFieldList[j].split('||')[4].split('/')[2];
}
}
}
else {
objStructured[customFieldList[j].split('||')[0]] = customFieldList[j].split('||')[1];
}
checkExistance = checkExistance + "," + customFieldList[j].split('||')[0];
}
}
}
objStructured[defaultTaskColumnAray[10]] = data[i].GUID
objStructured[defaultTaskColumnAray[11]] = data[i].ServiceRequestGUID
structuredData.push(objStructured)
}
//Below code collapse all the panels of the panel bar
panelbar.collapse($("li", panelbar.element));
options.success(structuredData)
}
else {
//Below code collapse all the panels of the panel bar
panelbar.collapse($("li", panelbar.element));
divSearchGrid.html('<h4>No records To Display</h4>')
// To stop the Auto Refresh of the grid if there are no results
isEditing = true;
}
}
else {
divSearchGrid.html('<h4>Some Error Occured</h4>')
}
}
})
}
},
pageSize: 10
},
batch: true,
groupable: true,
scrollable: true,
dataBound: GridDataBound,
sortable: true,
reorderable: true,
resizable: true,
selectable: "row",
editable: true,
columns: columnList,
columnMenu: true,
filterable: true,
columnMenu: {
sortable: false
},
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5,
pageSizes: [10, 25, 50, 100, 200]
},
});
任何帮助都将受到高度赞赏。
答案 0 :(得分:0)
这应该可以解决你的问题:
.k-group .k-popup .k-reset
{
max-height: 50px !important;
overflow-y: scroll !important;
}
答案 1 :(得分:0)
这是KendoUI发布之前发生的变化。以前,你有一个有限的垂直空间,现在你有所有的窗口。不应该有太大的区别,因为无论如何你应该有一个垂直滚动。
无论如何,你可以像@Bobby_D_建议的那样限制垂直间距,但是将滚动定义为:
.k-group.k-popup.k-reset {
max-height: 200px !important;
}
您可以在此处查看:http://jsfiddle.net/OnaBai/8k8NN/6/
答案 2 :(得分:0)