Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
Disabling row selection on a row by row basis
posted

Does anyone know how to disable the selection certain rows within a grid on a row by row basis?

My grid is used to display a list of users and a variety of information about each one, what I need to do is disable the selection of a few of those rows based on a particular permission of the user who is viewing the list.  If the user does not have permission to select a user, I need to disable the selection of that particular row.

What I was thinking, was in the InitializeRow event, check the value of a hidden column of that row, and depending on the value either disable or enable row selection.  However, I am unable to find any sort of property which will allow me to do this.

Any help would be greatly appreciated!!

  • 875
    Verified Answer
    posted

    I actually found a way to do it myself.  I implemented the BeforeSelectChange client side event and have done the following in the event handler:

        function SearchResultsGrid_BeforeSelectChange(gridName, id) {
            var row = igtbl_getRowById(id);
            if (row != null) {
                var value = row.getCellFromKey("PermissionValue").getValue();

                if (value == 1) {
                    // permission granted.
                    return false;
                }
                else {
                    // permission not granted.
                    return true;
                }
            }
        }

    This seems to do what I am looking for.  :)