删除时的jQGrid主键问题 [英] jQGrid primary key issue when delete

查看:102
本文介绍了删除时的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:

  1. 如果UserId列中的值在页面上是唯一的,并且可用于标识行,则可以将key:true属性添加到colModel中的UserId列定义中.
  2. 您可以使用提交前 onclickSubmit 事件以修改postdata参数并添加其他内容信息将被发送到服务器.有关示例,请参见此处.
  3. 使用与 delData 属性我在 serializeDelData 事件.请参见此处
  1. If the value from the UserId column is unique on the page and can be used to identify the row you can add key:true property to the UserId column definition in the colModel.
  2. 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.
  3. Use delData property exactly like editData which I described here.
  4. Use serializeDelData event. See here and this.

这篇关于删除时的jQGrid主键问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆