jQWidgets Forums

jQuery UI Widgets Forums Grid How to highlight a single row in grid

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • How to highlight a single row in grid #5102

    SS
    Member

    Hi Peter,

    Please tell me how can i highlight or change color of a single row in jqxGrid,
    and
    how to set editable property false for any single row of grid.

    Thanks
    SS

    How to highlight a single row in grid #5114

    Peter Stoev
    Keymaster

    Hi SS,

    You can disable editing of an entire row by setting up a ‘cellbeginedit’ function to all Grid columns and in the function’s implementation check the row’s index and return false, if you want to disable the editing for the particular row.

    For example:

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

    To highlight a row, you will need to do something similar, but with the cellsrendering function. For more information about it, take a look at this help topic: jquery-grid-cellsrendering.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How to highlight a single row in grid #5381

    SushmaSriram
    Member

    Hi Peter,

    The suggestion for disabling a row looks fine. But in my case I may have 100 rows wherein each row has an attribute value,say enable : true or false obtained from arraylist or json, based on which the row has to be disabled. So this needs to be dynamic. Could you please suggest me with an example.

    Regards,
    Sushma

    How to highlight a single row in grid #5389

    Peter Stoev
    Keymaster

    Hi Sushma,

    The ‘cellbeginedit’ function is called when the user tries to enter a cell into edit mode. It is dynamically called and you can implement your custom logic inside that function and return true or false depending on whether you want to edit the cell or not. The Grid has a method called ‘getrowdata’ which accepts a row index as parameter and returns the row’s data. I suppose that you can use that method to get the row’s attribute value.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.