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.
Unfortunately, activation email could not send to your email. Please try again.

Unselectable rows in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

120190 Sep 9,2015 08:48 AM Sep 10,2015 02:17 AM JavaScript 1
loading
Tags: ejGrid
Stefano Enrico
Asked On September 9, 2015 08:48 AM

Hi,

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

Thanks
Regards
Stefano

Balaji Marimuthu [Syncfusion]
Replied On September 10, 2015 02:17 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;