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.

How to select row in grid combining checkbox selection and basic selection

Thread ID:

Created:

Updated:

Platform:

Replies:

130744 May 30,2017 01:03 PM May 31,2017 11:58 AM ASP.NET Web Forms 1
loading
Tags: Grid
Anuar Raad Licona
Asked On May 30, 2017 01:03 PM

Hi, I'm using syncfusion grid, now I see in the page  the use of checkboxselection
http://asp.syncfusion.com/demos/web/grid/checkboxselection.aspx

Now when the row is selected in another column different of the checkboxcolumn the event not work.

Exist a form of combine the basic selection with the checkbox selection, I need the checkbox but also the user select the row in any cell

Jayaprakash Kamaraj [Syncfusion]
Replied On May 31, 2017 11:58 AM

Hi Anuar, 

Thank you for contacting Syncfusion support. 

We have achieved your requirement using recordClick event of ejGrid. In this event , we need to pass rowIndex in selectRows method when checkSelectedRowsIndexes as null or undefined else we need to push selected row index into checkSelectedRowsIndexes and then we need to pass checkSelectedRowsIndexes in selectRows method of Grid. Please refer to the below help document, code example and sample. 




<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
             <div> 
        <asp:UpdatePanel runat="server"> 
            <ContentTemplate> 
                <ej:Grid ID="OrdersGrid" runat="server" ClientIDMode="Static" AllowPaging="True"   > 
                    <ClientSideEvents RecordClick="recordClick" /> 
                    <Columns> 
                        <ej:Column Type="checkbox" Width="90"></ej:Column> 
.. 
                  
                </ej:Grid> 
            </ContentTemplate> 
        </asp:UpdatePanel> 
        <script type="text/javascript"> 
        function recordClick(args) { 
            var index = this.model.pageSettings.currentPage - 1; 
            if (!($(args.cell).hasClass("e-checkcell"))) { 
                if (ej.isNullOrUndefined(this.checkSelectedRowsIndexes[index])) 
                    this.selectRows(args.rowIndex); 
                else if ($(args.row).attr("aria-selected")) { // Deselecting 
                    $(args.row).removeAttr("aria-selected").find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"); 
                    var checkBoxIndex = $.inArray(args.rowIndex, this.checkSelectedRowsIndexes[index]); 
                    this.checkSelectedRowsIndexes[index].splice(checkBoxIndex, 1); 
                    $(args.row).find(".e-checkcelldiv [type=checkbox]").prop("checked", false); 
                } 
                else { 
                    this.checkSelectedRowsIndexes[index].push(args.rowIndex); 
                    this.selectRows(this.checkSelectedRowsIndexes[index]); 
                } 
            } 
        } 
    </script> 
 
</asp:Content> 


Regards, 

Jayaprakash K. 

 


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.

;