[英]Questions About and Issues With JqGrid
我確定我的問題已在某處得到解決,但是我已經研究了一段時間,而且似乎找不到我要找的答案。
navGrid
和inlineNav
功能創建網格,如下所示: $("#attributeEditList").jqGrid( {
datatype: "local",
height: 150,
colNames: ['rowid', 'Vendor', 'Category', 'Key', 'Value', 'Flags', 'Status'],
colModel: [
{name: 'rowid', index: 'rowid', hidden: true, key: true},
{name: 'vendorCode', index: 'vendorCode', hidden: true},
{name: 'category', index: 'category', width: 120, editable: true, editrules:{required: true} },
{name: 'key', index: 'key', width: 120, editable: true, editrules:{required: true} },
{name: 'value', index: 'value', width: 200, editable: true, editrules:{required: true} },
{name: 'flags', index: 'flags', width: 80, editable: true, editrules:{required: true, integer: true} },
{name: 'status', index: 'status', hidden: true }
],
sortname: "category",
viewrecords: true,
caption: "Attributes",
rowNum: 20000,
pager: '#attributeEditPager',
editurl: "vendor/ajax/dummy.do",
data: vendor.attributes,
jsonReader : { repeatitems: false }
});
$("#attributeEditList").jqGrid( "navGrid", '#attributeEditPager', {
edit: false,
add: false,
del: true,
search: false,
refresh: false,
delfunc: deleteAttribute
}
);
$("#attributeEditList").jqGrid( "inlineNav", '#attributeEditPager' );
editurl
參數是必需的,並且實際上必須是有效的url,以便編輯工作。 inlineNav
功能時遇到的最大問題。 首先,我單擊“添加(+)”按鈕添加一行,添加數據,然后單擊“保存”按鈕。 然后,如果我再次單擊“添加”按鈕,則會添加新行,但“添加”和“編輯”按鈕仍處於活動狀態,而“保存”和“取消”按鈕仍處於禁用狀態。 如果您對這些問題有任何建議,請告訴我。
從舊答案中查看演示 , 在此我演示了如何在jqGrid中實現本地表單編輯。 您的第一個問題是關於navGrid
添加的“刪除”。 因此,您可以在設置processing: true
使用此技巧processing: true
,我建議使“刪除”按鈕在本地工作。 您還應該使用editurl: 'clientArray'
。 我大約在一年前就向Trirand發布了我的建議(請參閱此處 ),但是本地表單編輯仍然不是jqGrid的一部分。
沒錯,在很多情況下inlineNav
並且如果用戶以其他順序單擊按鈕,則會激活或禁用錯誤的按鈕。 您必須使用$("#attributeEditList_ilsave").removeClass('ui-state-disabled');
手動激活/停用按鈕$("#attributeEditList_ilsave").removeClass('ui-state-disabled');
或$("#attributeEditList_ilsave").addClass('ui-state-disabled');
。 按鈕的id將由gridid和后綴“ _iladd”,“ _ iledit”,“ _ ilsave”,“ _ ilcancel”構造。 我建議您在onSelectRow
或beforeSelectRow
包含此類代碼,直到在jqGrid的主要代碼中未修復錯誤為止。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.