jQWidgets Forums

jQuery UI Widgets Forums Grid Validate Grid on Button Click

This topic contains 2 replies, has 2 voices, and was last updated by  harafa 11 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Validate Grid on Button Click #46362

    harafa
    Participant

    Hi Guys,

    I have a grid with the following columns
    columns: [
    { text: ‘Id’, datafield: ‘Id’, editable: false, width: ’30px’ },
    { text: ‘First Name’, datafield: ‘FirstName’,
    validation: function (cell, value) {
    if (value ==””) {
    return { result: false, message: “First name required!” };
    }
    return true;
    }

    }
    ]

    this validation is triggered only when entering cell and leave it blank.
    the question is:
    how to trigger this validation on button click before submitting data to the server.
    I checked all Grid’s Api and cannot find a method to trigger this validation rule.

    Thank you very much and best regards

    Validate Grid on Button Click #46381

    Dimitar
    Participant

    Hello harafa,

    There is no validation method for jqxGrid. However, you may do the following on the click of a button:

    $("#validateButton").click(function () {
        var value = $('#jqxgrid').jqxGrid('getcellvalue', 0, "FirstName");
        if (value == "") {
            $("#jqxgrid").jqxGrid('showvalidationpopup', 0, "FirstName", "Invalid Value");
        };
    });

    Best Regards,
    Dimitar

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

    Validate Grid on Button Click #46545

    harafa
    Participant

    Thank you very much Dimitar 🙂

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

You must be logged in to reply to this topic.