jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Trigger Validation Check on Grid Programmatically
Tagged: edit, grid, jqxgrid, jqxvalidator, programatically, validation, validator
This topic contains 4 replies, has 4 voices, and was last updated by Dimitar 9 years, 3 months ago.
-
Author
-
Hi all,
I understand that we can define validation rule for columns in jqxGrid. Can we trigger the validation check on the grid programmatically? Something similar to jqxValidator’s $(‘#form’).jqxValidator(‘validate’) and $(‘#form’).jqxValidator(‘validateInput’, ‘#passwordInput’). Thank you.
Thanks,
slsu90Hello slsu90,
Unfortunately, it is not possible to trigger validation programmatically. Validation is only done when editing a cell in jqxGrid.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi;
I think, you can trigger such as follow. in this manner, you emulate cell validation.$(“#jqxgrid”).jqxGrid(‘begincelledit’, rowid, datafield);
$(“#jqxgrid”).jqxGrid(‘endcelledit’,rowid, datafield);When you run these methods orderly; cell validation will be triggered.
I am just surprised that most of the reply by JQWidget team “Unfortunately, it is not possible ” while lot of things are possible 🙁
below is one way we are using
`function validateAppRoleGrid (gridObject)
{
var flag = true;
var totalRows = gridObject.jqxGrid(‘getrows’).length;
var rows = gridObject.jqxGrid(‘getrows’);
for(i =0;i<totalRows;i++){
$.each(appRoleColumns,function(index,element){
var cellData = gridObject.jqxGrid(‘getcelltext’, i, element.name);
var tableColumn = gridObject.jqxGrid(‘getcolumn’, element.name);
//DO YOUR VALIDATION here
if ((cellData == undefined || cellData == “”)&& element.name == ‘roleCode’)
{
flag = false;
}
else if ((cellData == undefined || cellData == “”)&& element.name == ‘narrative’)
{
flag = false;
}
else if ((cellData == undefined || cellData == “” || cellData == -1)&& element.name == ‘roleTypeId’)
{
flag = false;
}
else if ((cellData == undefined || cellData == “”)&& element.name == ‘startDate’)
{
flag = false;
}
});
}
return flag;
}`
before submit call this functionHello sohailkhalid,
Thank you for your contribution. However, please note that the initial question was about programmatically invoking the jqxGrid’s built-in validation callback (the demo Editing shows it in action).
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.