我正在尝试在我的 jqGrid 上初始化内联导航器。使用版本 4.4.0。代码:
$('#line-items-grid').jqGrid({
caption : '',
width : 704,
shrinkToFit : 1,
forceFit : true,
scrollOffset : 0,
url : '',
datatype : 'local',
rowNum : 20,
viewrecords : true,
height : 'auto',
gridview : true,
autoencode : true,
pager : '#line-items-pager',
colModel : [
{label: 'Commodity', name: 'contract_material', sortable: false, width: 99, cellattr: word_wrap, editable: true, classes: 'line-item-contract-material', edittype: "select"},
{label: 'Date', name: 'date', sortable: false, width: 77, cellattr: word_wrap, editable: true, classes: 'line-item-date', editoptions: {
dataInit: function (el) {
$(el).datepicker();
}
}},
{label: 'Vendor', name: 'vendor', sortable: false, width: 95, cellattr: word_wrap, editable: true, classes: 'line-item-vendor', editoptions: {maxlength: "50"}},
{label: 'Ticket/PO#', name: 'ticket_po_num', sortable: false, width: 66, cellattr: word_wrap, editable: true, classes: 'line-item-ticket-po-num', editoptions: {maxlength: "50"}},
{label: 'Lbs', name: 'lbs', sortable: false, width: 73, cellattr: word_wrap, editable: true, classes: 'line-item-lbs'},
{label: 'Units', name: 'units', sortable: false, width: 49, cellattr: word_wrap, editable: true, classes: 'line-item-units'},
{label: 'Rate/Ton', name: 'rate_per_ton', sortable: false, width: 64, cellattr: word_wrap, editable: true, classes: 'line-item-rate-per-ton'},
{label: 'Rate/Unit', name: 'rate_per_unit', sortable: false, width: 64, cellattr: word_wrap, editable: true, classes: 'line-item-rate-per-unit'},
{label: 'Total', name: 'total', sortable: false, width: 72, cellattr: word_wrap, editable: true, classes: 'line-item-total'}
],
jsonReader : {
repeatitems: false
},
onSelectRow : function (id) {
if (id && id !== lastsel) {
$('#line-items-grid').jqGrid('restoreRow', lastsel);
$('#line-items-grid').jqGrid('editRow', id,
{
keys: true,
extraparam: {
reporting_period_id: function () { return $('#reporting_period_filter').val(); },
pickup_id: function () { return $('#pickup_filter').val(); },
lbs_per_ton: function () { return material_lbs_per_ton[$('#line-items-grid tr#' + id).find('td.line-item-contract-material select').val()]; }
},
oneditfunc: lineItemEditPrep,
aftersavefunc: lineItemSuccess,
errorfunc: lineItemError,
afterrestorefunc: function () { $('.qtip').qtip('destroy'); },
restoreAfterError: false
});
//clear out error messages
$('.qtip').qtip('destroy');
lastsel = id;
}
},
gridComplete : lineItemViewPrep,
editurl : "line_items/line_item_edit"
});
$('#line-items-grid').jqGrid('navGrid', '#line-items-pager', {
add: false,
edit: false,
del: false
});
$('#line-items-grid').jqGrid('inlineNav', '#line-items-pager');
我得到了显示常规导航器(查看和刷新)的按钮,但没有显示内联导航器的按钮。我错过了什么?
(旁注,如果相关:我正在将数据加载到网格中的单独函数上设置 url 和 datatype 选项。)