This is a migrated thread and some comments may be shown as answers.

Column with checkbox

4 Answers 437 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hugo
Top achievements
Rank 1
Hugo asked on 07 Aug 2012, 09:58 PM
Hi,

I'm using the kendo grid control and I have a column that is a checkbox.  It's there a way to catch the event when the user check or uncheck the checkbox for a row ?

Regards

4 Answers, 1 is accepted

Sort by
0
Bruno Larose
Top achievements
Rank 2
answered on 09 Aug 2012, 06:28 PM
Please can you send a sample project?

thanks
0
Hugo
Top achievements
Rank 1
answered on 20 Aug 2012, 07:30 PM
Yes sure so here it's my view (my project is in VS with MVC).

    <div id='containerGrid' class='grid_12'>
        <div class='grid_3'>&nbsp</div>
        <div id='gridKendo' class='grid_8'>
            
        </div>
    </div>

<script id="rowTemplate" type="text/x-kendo-tmpl">
    <tr>
        <td>
            <a href="/User/UserDetails?Username=${Username}">${Username}</a>            
        </td>
        <td>
            ${ Email }
        </td>
        <td> 
            #if(ActiveUser){#
                <input type="checkbox" checked="checked" />
            #}else{#
                <input type="checkbox" />
            #}#
                   
        </td>
    </tr>
</script>


Here my javascript related to the kendo.

        $("#gridKendo").kendoGrid({
            dataSource: {
                data: data,
                pageSize: 10
            },
            groupable: false,
            sortable: false,
            selectable: "row",
            filterable: true,
            sortable: true,
            resizable: true,
            reorderable: true,
            pageable: {
                refresh: false,
                pageSizes: true
            },
            rowTemplate: kendo.template($("#rowTemplate").html())
        });

Here I added a screenshot what look like the grid.

So my goal is when the user click the checkbox in a row to catch this event, know the row selected.  

Thank you
0
Accepted
Shane
Top achievements
Rank 1
answered on 27 Aug 2012, 05:27 PM
Add an onclick to the input type and then find the parent TR element using Javascript.  

#if(ActiveUser){#
     <input type="checkbox" checked="checked" onclick="DoSomething(this);" />
#}else{#
     <input type="checkbox" onclick="DoSomething(this);"
/> #}#


0
Hugo
Top achievements
Rank 1
answered on 28 Aug 2012, 07:09 PM
Thank you 
Tags
Grid
Asked by
Hugo
Top achievements
Rank 1
Answers by
Bruno Larose
Top achievements
Rank 2
Hugo
Top achievements
Rank 1
Shane
Top achievements
Rank 1
Share this question
or