0
我已經實現了一個jqGrid,但是當我嘗試使用內置的表單編輯功能時,會彈出一個空表單。jqGrid編輯記錄表空
對於我設置了editable的每一列:除了表的主鍵,一個自動遞增的ID。我究竟做錯了什麼?我需要有一個有效的editurl,而不是clientArray?下面是jqGrid的實現:
$.ajax({
type: "GET",
url: colUrl,
datatype: "json",
success: function(result){
result = jQuery.parseJSON(result)
var colN = result.colNames;
var colM = result.colModelList;
$("#jqTable").jqGrid({
url:dataUrl,
datatype: 'xml',
mtype: 'GET',
colNames:colN,
colModel:colM,
shrinkToFit: false,
caption: db + "." + table,
pager: '#jqPager',
rowNum:10,
rowList:[10,20,30],
sortname: 'dbid',
editurl: 'clientArray',
sortorder: 'asc',
viewrecords: true,
width: 1000,
height: 400
});
$("#jqTable").jqGrid('navGrid', '#jqPager',
{edit:true, add:false, del:false, search:true, view:false}, //options
{}, // edit options
{}, // add options
{}, // del options
{multipleSearch:true,
sopt : ['eq',//equals
'ne',//not equals
'lt',//less than
'le',//less than or equal
'gt',//greater than
'ge',//greater than or equal
'bw',//begins with
'bn',//does not begin with
'in',//in
'ni',//not in
'ew',//ends with
'en',//does not end with
'cn',//contains
'nc']//does not contain
}, // search options
{} //view options
);
},
error: function(x,e){
alert(x.readyState + " " + x.status + " " + e.msg);
}
});
,這裏是樣品colModel和COLNAME字符串:
"colModelList": [{"name":"dbid","index":"dbid","editable":"false"},{"name":"description","index":"description","editable":"true"},{"name":"file_name","index":"file_name","editable":"true"}],"colNames": ["dbid","description","file_name"]
將「editable」:「true」更改爲「editable」:true,表單變爲填充狀態。真棒! – Andrea 2011-05-16 14:54:21
@Andrea:在[www.json.org](http://www.json.org/)上,您可以發現布爾數據類型應該不用雙引號進行編碼。 – Oleg 2011-05-16 14:59:51
有時候這是最簡單的事情......我正在重寫我的應用程序的控制流,並且已將所有可編輯項的默認設置爲「false」,並且無法弄清楚發生了什麼。發現我的錯誤,並修復它,謝謝:) – blong 2011-08-24 14:52:52