jqgrid内联添加 [英] jqgrid inline add
本文介绍了jqgrid内联添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
jqGrid目前不包含内联添加是正确的。
Is is correct that jqGrid doesn't currently contain an inline add.
我正试图让这个工作起作用:
I'm trying to get this working from:
http://www.trirand。 net / forum / default.aspx?g = posts& t = 212
这里有几个例子,但它们并没有像我一样工作希望。
There are a couple of examples there but they're not working quite as I would like.
任何人都知道一个好例子
Anybody know of a good example
推荐答案
尝试这个:
pager: '#id_pager',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"...",
cellEdit: true,
editurl:"....",
beforeSelectRow: function (id) {
if (id !== lastSel) {
jQuery("#id_grid").jqGrid('restoreRow', lastSel);
lastSel = id;
}
return true;
},
onSelectRow: function (id, iRow, iCol, e) {
jQuery("#id_grid").jqGrid('editRow', id, true, function(){
jQuery("input, select").focus();
});
return;
}
并添加一个带有navButtonAdd的按钮:
And add a button with navButtonAdd:
.navButtonAdd("#id_pager", {
caption: "",
buttonicon: "",
onClickButton: function () {
var datarow = { id: "", name: "", address: "" };
var su = jQuery("#id_grid").addRowData("X", datarow, "first");
if (su) { jQuery("#id_grid").setSelection('X'); }
},
position: "last"
});
不要忘记添加可编辑:true
,在每个colModel。
我希望可以帮到你解决问题。谢谢
Don't forget for add editable: true
, at every colModel.
I hope can help your problem. Thanks
这篇关于jqgrid内联添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文