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

row numbering and checkbox for multiselect

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

3 Replies

AR Ajith R Syncfusion Team February 18, 2015 10:58 AM UTC

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




JS Jeong Sik Yoo February 26, 2015 06:17 AM UTC

everything works now. Thank you for your suport.

Greetings.



AS Alan Sangeeth S Syncfusion Team March 2, 2015 04:13 AM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon