以下代码会生成没有可编辑单元格的表格。更重要的信息是,这是在WordPress页面模板中。 JavaScript文件肯定包含在页面中。知道为什么吗?
var opts = {
url:'/api1/testjson.php',
datatype: 'json',
mtype: 'GET',width: true,
colNames:['{Category}','{desc}', '{amount}', '{date}', '~'],
colModel :[{name:'category', index:'category', width:50, editable:true },
{name:'name', index:'desc', width:50, editable:true },
{name:'color', index:'amount', width:30, editable:true },
{name:'date', index:'date', width:30, editable:true },
{name : 'end', index: 'end', width:10, formatter:'actions',
formatoptions: {
keys: true,
editbutton: false,
align: 'center',
delOptions: { url:'${urlDelete}', dataType: "json" }}}],
jsonReader : {
root:"entryData",
page: "currentPage",
total: "totalPages",
records: "totalRecords",
repeatitems: false,
id: "id"
},
sortname: 'date',
sortorder: 'asc',
viewrecords: true,
height: 'auto',
onSelectRow: function(id){
},
};
$("#jqtable1").jqGrid(opts);
opts.url = '/api1/testjson2.php';
$("#jqtable2").jqGrid(opts);
答案 0 :(得分:0)
我只需要处理rowselect事件
onSelectRow: function(id){
if(id && id!==lastSel){
jQuery('#grid_id').restoreRow(lastSel);
lastSel=id;
}
$(this).editRow(id, true);