Reputation: 162
As it commented in another question (jqgrid editoptions custom_func with required=false) , now I need to validate input with custom_func. This validation requires to compare the input value with another columns values entered by the user. In other words, need to get all the current row values before submit to decide the validation result. I managed to get some specific column this way...
function myCustomFunc(value, colName) {
//consider I have a global var "selRowId" which is updated onSelectRow event.
var someColValue = $('select#'+selRowId+'_someColName').val();
// ... here the validation using the "someColValue" ...
}
I think this is NOT the best method. I would prefer some method which returns an object similar to "getRowData" but containing all the input values from the user.
I am using jqGrid 4.6.0
Upvotes: 0
Views: 1249
Reputation: 221997
It seems that you use inline editing. jqGrid in the version 4.6 has no other possibilities to access to the current values, but the current sources of free jqGrid (preliminary version 4.13.7 from GitHub) contains new callback saveRowValidation
and the event jqGridInlineSaveRowValidation
, which could simplify what you need to implement.
The callback saveRowValidation
contains one parameter, like the most other callbacks implemented in free jqGrid. The parameter, let us we name it options
, contains the following properties
mode
with the value "edit"
or "add"
rowid
- the value of id attribute of the editing rownewData
- the object with modified data of the rowsavedRow
- the object with the data of the row before editingoptions
- the options of inline editingiRow
- the index of the row from the top of the gridtr
- DOM element, which represent the editing rowI think that options.newData
is what you need. See the comment to the commit for more details.
Upvotes: 1