Jqgrid在内联编辑上更改值 [英] Jqgrid Change values on inline edit
问题描述
我的页面上只有一个网格,例如当它进入内联编辑模式时,一旦用户填写了第一个网格,我想填写一些字段(基于价格的字段)他们输入了50的价格,我想更新nett和Gross字段.
I have got a single grid on my page, and when it drops into inline edit mode there are some fields i would like to fill in (price based ones) as soon as the user has filled the first one in, for example they put a price of 50 in, i want to update the nett and gross fields.
通常我会使用jquery模糊功能来执行此操作,但是我不确定如何获取网格上输入框的名称,它们似乎是一个数字,具体取决于行,然后是字段名称
Normally i would do this using a jquery blur function, but i'm not sure how to get the names of the input boxes on the grid, they seem to be a number depending on the row, then the name of the field.
谢谢 卢克
推荐答案
Typically is you need update the cell after the user modified the cell value one use cell editing mode. In case of usage inline editing mode for row editing you have some options:
- 您使用键:true 参数和该行将在用户按 Enter 键后保存.用户可以随时按 Esc 键放弃更改.
- 您提供了一些按钮,用户可以单击这些按钮来保存更改.您可以使用格式化程序:操作", inlineNav 或您的自定义按钮来执行此操作.
- 您可以在
onSelectRow
或其他一些回调中保存当前编辑的 row .
- you initialize inline editing with keys: true parameter and the row will be saved after the user press Enter key. The user can any time discard the changes by pressing Esc key.
- you provide some button which the user can click to save the changes. You can use formatter: 'actions', inlineNav or your custom button to do this.
- You can implement saving of current editing row inside of
onSelectRow
or some other callback.
以任何方式,内联编辑模式中的标准方法都是对行进行操作,而无需基于单元格进行其他操作.如果确实需要将blur
或focusout
事件绑定到编辑行的所有输入字段,则可以将dataEvents
与type: 'blur'
(或type: 'focusout'
)结合使用.为了轻松定义所有列的编辑选项,您可以使用jqGrid的cmTemplate
选项(请参见此处).
In any way the standard way in inline editing mode is working with rows without additional actions on cell basis. If you do need to bind blur
or focusout
event to all input fields of editing row you can use dataEvents
with type: 'blur'
(or type: 'focusout'
). To easy define the editoptions for all columns you can use cmTemplate
option of jqGrid (see here).
这篇关于Jqgrid在内联编辑上更改值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!