如何在jqGrid中修复标题?
正如您在图像中看到的那样,滚动条位于标题旁边,它随数据滚动,页脚会很好。
!http://i57.tinypic.com/ilveq8.jpg
!http://i60.tinypic.com/2yx0l55.jpg
这是我用于网格的javascript:
$('#list').jqGrid({
url: url,
datatype: 'json',
colNames:colNames[lang],
colModel:[ {name:'Image', index:'Image', width:50,formatter: imageFormatter, align: 'center', sortable:false, search:false},
{name:'ItemId', index:'ItemId', width:125, align: 'center'},
{name:'ItemName', index:'ItemName', width:445, align: 'left'},
{name:'UnitId', index:'UnitId', width:40, align: 'center', sortable:false, search:false},
{name:'MultipleQty', index:'MultipleQty', width:40, align: 'right', sortable:false, search:false},
{name:'SheetSeparator', index:'SheetSeparator', width:40, align: 'right', sortable:false, search:false},
{name:'StandardPalletQuantity', index:'StandardPalletQuantity', width:40, align: 'right', sortable:false, search:false},
{name:'Quantity', index: 'Quantity', width:75,align:'center',editable:true,sortable:false,editrules:{number:true}, edittype:'text', editoptions:{size:5,maxlength:8}, search:false, classes:'quantityRed'},
{name:'Price', index:'Price', width:70, align: 'center', sortable:false, search:false},
{name:'Basket', index:'Basket', width:75, align: 'center', sortable:false, search:false},
// {name:'Info', index:'Info', width:50, align: 'center', sortable:false, search:false},
],
pager: '#pager',
// toppager:true,
// cloneToTop:true,
cellEdit: true,
rowNum:25,
rowList:[25,50,75],
sortname: 'ItemId',
viewrecords: true,
caption: caption[lang],
height:'500',
cellsubmit: 'clientArray',
recreateFilter:true,
afterInsertRow: function(rowid, aData) {
$('#list').setCell(rowid, 'Quantity', '', '', { 'title': quantityToolTip});
},
afterSaveCell : function(rowid,name,val,iRow,iCol) {
var itemId = jQuery('#list').jqGrid('getCell',rowid, 'ItemId');
var multipleQty = jQuery('#list').jqGrid('getCell',rowid, 'MultipleQty');
//alert('Bestelling ' + val + ' stuks van ' + itemId + ' te bestellen per ' + multipleQty);
validateQuantity(rowid, val, multipleQty);
},
onCellSelect: function (rowid, iCol, cellContent, e) {
if (iCol === 7){
$("#list").jqGrid('setCell', rowid, 'Basket', '<img src="/img/basket_off.gif">');
$("#list").jqGrid('setCell', rowid, 'Quantity', ' ');
}
if (iCol === 9 && e.target.nodeName.toLowerCase() === "img" && cellContent.toLowerCase() === '<img src="/img/basket_on.gif">') {
add2Basket(rowid, e);
}
if (iCol === 10) {
showInfo(rowid);
}
},
loadComplete: function() {
$("#list").jqGrid("setLabel","UnitId","",{"text-align":"left"});
}
});
$('#list').jqGrid('filterToolbar','{stringResult:false,defaultSearch:cn, searchOnEnter:true}');
//$('#list').jqGrid('navGrid','#pager',{add:false,edit:false,del:false,cloneToTop:true});
$('#list').jqGrid('navGrid','#pager',{add:false,edit:false,del:false});
// reset url
$('#list').setGridParam({url:url});
// reset search parameters
$("#list").jqGrid('setGridParam', { search: false, postData: { "filters": ""} });
$('#list').trigger('reloadGrid');