jQWidgets Forums

jQuery UI Widgets Forums Grid Trigger Validation Check on Grid Programmatically

This topic contains 4 replies, has 4 voices, and was last updated by  Dimitar 9 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • slsu90
    Member

    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,
    slsu90


    Dimitar
    Participant

    Hello slsu90,

    Unfortunately, it is not possible to trigger validation programmatically. Validation is only done when editing a cell in jqxGrid.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    ziyahan
    Participant

    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.


    sohailkhalid
    Participant

    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 function


    Dimitar
    Participant

    Hello 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,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.