jQWidgets Forums

jQuery UI Widgets Forums Grid Lock some rows in an editable grid

This topic contains 5 replies, has 3 voices, and was last updated by  Peter Stoev 11 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Lock some rows in an editable grid #5025

    SushmaSriram
    Member

    Hi Team,

    In an editable grid, is it possible to lock some rows from editing?

    If yes, could you please help me with an example.

    Regards,
    Sushma

    Lock some rows in an editable grid #5047

    Peter Stoev
    Keymaster

    Hi Sushma,

    You can achieve that by setting up a ‘cellbeginedit’ function to a Grid column and in the function’s implementation check the row’s index and return false, if you want to disable the editing for that row.

    For example:

                      { text: 'First Name', columntype: 'textbox', datafield: 'firstname', width: 90,
    cellbeginedit: function (row, datafield) {
    if (row == 0)
    return false;
    }
    },

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Lock some rows in an editable grid #5070

    SushmaSriram
    Member

    Hi Peter,

    Your example gives perfect thought when the row numbers are exactly known.

    But in my case i have hundreds of rows and the locking of the rows differ based on the data. So i need to lock the rows dynamically. Could you please suggest me.

    Regards,
    Sushma

    Lock some rows in an editable grid #5086

    Peter Stoev
    Keymaster

    Hi Sushma,

    The cellbeginedit function is called dynamically, too. The function is called when the user begins an edit operation. It depends on your logic whether you will allow the editing for a specific row or not when the function is called.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Lock some rows in an editable grid #23099

    ghunter
    Member

    I tried returning false from my function and it didn’t work. This is what worked for me to disable editing in the first column:

        $("#jqxgrid").on('cellbeginedit', function (event) {
    var column = args.datafield;
    var row = args.rowindex;
    if( $('#jqxgrid').jqxGrid('getcolumnindex', args.datafield) == "0") {
    $("#jqxgrid").jqxGrid('endcelledit', row, column, true);
    }
    });
    Lock some rows in an editable grid #23101

    Peter Stoev
    Keymaster

    Hi,

    We have a working sample about that which is available online and which works as expected. I suppose that it will work on your side if you use the current version i.e the same as in the sample.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.