We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Unselectable rows in grid

Hi,

can I set one or more rows of a grid as unselectable? by what method?

Thanks
Regards
Stefano

1 Reply

BM Balaji Marimuthu Syncfusion Team September 10, 2015 06:17 AM UTC

Hi Stefano, 

Thanks for contacting Syncfusion support.

Your requirement is achieved by using the rowSelecting event in Grid which triggers before a row is selected.

Please refer to the Help document and code example as follows,

Document: http://help.syncfusion.com/js/api/ejgrid#events:rowselecting
Sample: http://jsplayground.syncfusion.com/x23vxig3

$("#Grid").ejGrid({

                // the datasource "window.gridData" is referred from jsondata.min.js

                dataSource: window.gridData,

                allowPaging: true,

                enableRowHover: false,

               

                . . .


                rowSelecting: function (args) {


                    var indexes = [0, 2, 4, 11];    // row indexes to be unselectable


                    if ($.inArray(args.rowIndex, indexes) != -1)

                        args.cancel = true;  //prevent selection


                }


            });



In above code example, we have prevented the row selection by setting the args.cancel as true to the row indexes 0, 2,4,11. So you can specify the indexes that are needs to be unselected in rowSelecting event.

Regards, 
Balaji Marimuthu


Loader.
Live Chat Icon For mobile
Up arrow icon