删除时的jQGrid主键问题 [英] jQGrid primary key issue when delete
本文介绍了删除时的jQGrid主键问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将行的主键作为jQGrid中的隐藏字段.它称为"UserId"
I have primary key of my row as hidden field in my jQGrid. It is called "UserId"
colNames: ['UserId', "Details" ...],
colModel: [{ name: 'UserId', index: 'UserId', editable: false, hidden: true },
{ name: 'Details', index: 'Details', editable: true, editactioniconscolumn: true },
...]
我可以创建和更新案例,但是删除有问题
I get worked create and update cases but i have an issue with delete
因为删除时我在控制器上返回了网格行的Id
而不是UserId
,
我可以将所有UserId's
保留在网格ID中,这是我目前所做的删除工作,但是我想知道是否有任何方法可以使隐藏的UserId
而不是网格行ID得到发布.
Because when delete i am getting an Id
of the grid row back on controller and not UserId
,
I can keep all UserId's
in grid id, that is what i am currently done to make delete work, but i am wondering is there any way to get my hidden UserId
getting posted instead of grid row Id.
推荐答案
您可以通过多种方式实现您的要求:
You can implement your requirements in many ways:
- 如果
UserId
列中的值在页面上是唯一的,并且可用于标识行,则可以将key:true
属性添加到colModel
中的UserId
列定义中. - 您可以使用提交前或 onclickSubmit 事件以修改
postdata
参数并添加其他内容信息将被发送到服务器.有关示例,请参见此处. - 使用与
delData 属性我在 serializeDelData 事件.请参见此处和
- If the value from the
UserId
column is unique on the page and can be used to identify the row you can addkey:true
property to theUserId
column definition in thecolModel
. - You can use beforeSubmit or onclickSubmit event to modify the
postdata
parameter and add additional information which will be send to the server. See here for an example. - Use delData property exactly like
editData
which I described here. - Use serializeDelData event. See here and this.
这篇关于删除时的jQGrid主键问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文