How to get a jqGrid cell value when editing

前端 未结 23 2637
日久生厌
日久生厌 2020-11-27 17:43

How to get a jqGrid cell value when in-line editing (getcell and getRowData returns the cell content and not the actuall value of the input element).

23条回答
  •  半阙折子戏
    2020-11-27 18:26

    I think that Aidan's answer is by far the best.

    $('#yourgrid').jqGrid("editCell", 0, 0, false);
    

    This commits any current edits, giving you access to the real value. I prefer it because:

    • You don't have to hard-code any cell references in.
      • It is particularly well suited to using getRowData() to get the entire grid, as it doesn't care which cell you've just been editing.
      • You're not trying to parse some markup generated by jqGrid which may change in future.
      • If the user is saving, then ending the edit session is likely the behaviour they would want anyway.

提交回复
热议问题