How to get a jqGrid cell value when editing

前端 未结 23 2261
日久生厌
日久生厌 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:23

    Basically, you have to save the row before you access the cell contents.

    If you do, then you get the value for the cell instead of the markup that comes when the cell is in edit mode.

    jQuery.each(selectedRows, function(index, foodId) {
                // save the row on the grid in 'client array', I.E. without a server post
                $("#favoritesTable").saveRow(foodId, false, 'clientArray'); 
    
                // longhand, get grid row based on the id
                var gridRow = $("#favoritesTable").getRowData(foodId);
    
                // reference the value from the editable cell
                foodData += foodId + ":" + gridRow['ServingsConsumed'] + ',';
            });
    

提交回复
热议问题