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.

row numbering and checkbox for multiselect

Thread ID:

Created:

Updated:

Platform:

Replies:

118254 Feb 17,2015 12:20 AM Mar 1,2015 11:13 PM JavaScript 3
loading
Tags: ejGrid
Jeong Sik Yoo
Asked On February 17, 2015 12:20 AM

I want to put the numbering and checkboxes on the grid
And do you know how an event when the checkbox checked?

thanks for read

Ajith R [Syncfusion]
Replied On February 18, 2015 05:58 AM

Hi Jeong,

Thanks for using Syncfusion products.

Query 1: I want to put the numbering and checkboxes on the grid

We suggest you to use template columns with rowDataBound client side event to put the numbering and checkboxes on the Grid. We can set numbering to the template column in the rowDataBound event based on its row index . Please refer the below code snippet for further details.

<script type="text/javascript">

        $(function () {

            $("#Grid").ejGrid({

                ---------

                ---------

                rowDataBound: "onRowDataBound",

                columns: [

                             { headerText: "Numbers", templateID: "#number" , template: true, textAlign: ej.TextAlign.Center, width: 100 },

                             { headerText: "Check", templateID: "#check" , template: true, textAlign: ej.TextAlign.Center, width: 100 },

                             ---------

                             ---------

                ]

            });

        });

       function onRowDataBound(args) {

            var currentPage = args.model.pageSettings.currentPage;

            var pageSize = args.model.pageSettings.pageSize;

            var count = args.row.index() + 1;

            if (currentPage > 1)

                count = ((currentPage - 1) * pageSize) + count;

            args.row.find("td.e-templatecell:eq(0)").html(count.toString()); // Bind number value

        }

        function onChange() {

            alert("Check box checked")

        }

</script>

<script type="text/x-jsrender" id="number"> <!--Number Template-->

</script>

<script type="text/x-jsrender" id="check"> <!--Checkbox Template-->

   <input type="checkbox" onchange="onChange()" />

</script>

Query 2: do you know how an event when the checkbox checked?

We suggest you to set onchange event to the checkbox element in the template and handle it in the script side to achieve your requirement. Please refer the above code snippet for further details.

For your convenience we have created a simple sample and the same can be downloaded from the below link.

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/118254/NumberingCheckbox-717702127.zip

Please get back to us if we misunderstood your requirement and please provide us more information regarding your requirement, So that we will be able to provide you the solution as soon as possible.

Please let us know if you have any concerns.

Regards,

Ajith R



Jeong Sik Yoo
Replied On February 26, 2015 01:17 AM

everything works now. Thank you for your suport.

Greetings.


Alan Sangeeth S [Syncfusion]
Replied On March 1, 2015 11:13 PM

Hi Jeong,

Thanks for the update.

We are happy to hear that your requirement has been achieved.

Please let us know if you need any further assistance.

Regards,
Alan Sangeeth S

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.

;