jQWidgets Forums

jQuery UI Widgets Forums Grid Server side column validation?

This topic contains 6 replies, has 4 voices, and was last updated by  admin 9 years, 11 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Server side column validation? #28386

    dujmovicv
    Participant

    Hi all,

    I have been using jqwidgets for my online web application, it is awesome!!!!
    I’m wondering if there is possible to do server side column validation i.e. there is a value which must not be empty :

    validation: function (cell, value) {
    if (value == "") {
    return { result: false, message: "Must not be empty!" };
    }
    return true;
    }

    which works fine. BUT : can I do some server side checking i.e. if there is already a record in the mysql table (check for a duplicate and alert when yes)????

    Thank you in advance.
    Best regards,
    Viktor

    Server side column validation? #28664

    dujmovicv
    Participant

    I’d appreciate if someone could direct me to the right place in this issue…. Thanks!

    Server side column validation? #28665

    Peter Stoev
    Keymaster

    Hi Victor,

    You can make synchronous Ajax call in the column’s validation function and return true or false depending on whether the validation passes or not. Another approach is to do the validation in the source object’s updaterow callback where you sync the updated row with the server and call commit(true) or commit(false) if the validation fails.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Server side column validation? #71985

    Chaitanya
    Participant

    Hi victor,

    i have command button(Edit) in my grid and when click on that button row become editable. I make ajax call to update row in db and some reason this ajax call fails. i want this row in edit mode and show validation failure msg near that column.
    Is it possible??

    Please refer following js fiddle link.
    <li>http://jsfiddle.net/chaitanya21/vfms29ma/10/</li>

    Server side column validation? #72001

    Peter Stoev
    Keymaster

    Hi Chaitanya,

    You have showvalidationpopup method in jqxGrid which you can use for that purpose. Example is available on the Grid’s API Documentation page.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Server side column validation? #72009

    Chaitanya
    Participant

    Hi Peter,

    Thanks..
    but how we can make row editable in updaterow method, if error occur in ajax call.

    `updaterow: function (rowid, rowData, commit) {
    if (flag == true) {
    commit(true);
    } else {
    $(“#jqxgrid”).jqxGrid(‘beginrowedit’, rowid); //here we dont have row number, rowid not working.
    commit(false);
    }
    },

    Js fiddle link

    Server side column validation? #72031

    admin
    Keymaster

    Hi Chaitanya,

    This is wrong approach. You should not call methods for begin edit within methods which are called when the edit has finished. I suggest you to think more how to do your task. Also beginrowedit requires Row’s Bound index, not the Row ID.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.