Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
MVC igGrid custom validator not returning row ID from ui object
posted

Hi,

I have an MVC project that's using a Databound igGrid to display and edit data.  In the Grid definition there's a custom validator for some of the columns defined as:

.Features(feature => {

feature.Updating().ColumnSettings(cs => {
cs.ColumnSetting().ColumnKey("ActvtyKey").ReadOnly(true);
cs.ColumnSetting().ColumnKey("MetrcTargtNbr").EditorType(ColumnEditorType.Text).Validation(true).EditorOptions("validatorOptions:{checkValue:validate}").Required(false);
cs.ColumnSetting().ColumnKey("MetrcInProcssNbr").EditorType(ColumnEditorType.Text).EditorOptions("validatorOptions:{checkValue:validate}").Required(false);
cs.ColumnSetting().ColumnKey("MetrcCompltdNbr").EditorType(ColumnEditorType.Text).Validation(true).EditorOptions("validatorOptions:{checkValue:validate}").Required(false);
})
.EditMode(GridEditMode.Cell);
})

Testing that validator results in an undefined ui.rowID and this is needed as I must look at other cell values within the row being edited to return the validtor result.  My validtor function tester is as follows:

function validate(evt, ui) {
//this is undefined
alert(ui.rowID);
//this works
alert(ui.value);
}

Again, ui.rowID returns undefined and I've also tried ui.rowId.  The ui object seems to be there but maybe incomplete as ui.value does return the cell value being edited.  Is there something I am missing with the custom validtor definition on the Grid?  Please assist as this is very much needed for my project.  Thanks!