how to implement row level validation in jqgrid

后端 未结 1 483
时光取名叫无心
时光取名叫无心 2021-01-03 12:34

Before changed row is saved custom function needs to be called to validate save possibility.

If this custom function returns false, row save should be cancelled and

1条回答
  •  清酒与你
    2021-01-03 13:18

    If I understand you correct you should use custom validation editrules

    editrules: {
        custom:true,
        custom_func: function(value,colname) {
            // return [true,""] in case of successful validation
            // [false,"Your error message"]; in case of validation error
        }
    }
    

    See jqGrid documentation for the code example.

    jqGrid has only cell level validation, but depend on how you use inline editing (for example only one row is in editing mode an once) you can get the data from the whole editing row. You have many options. For example you can get the row data manually or just define validation rules for all columns which have an interest, inside of validation of the first columns you just save the value in the property of an external object and inside of the last validation function you can access all the saved data to make real row validation.

    0 讨论(0)
提交回复
热议问题