How to get the value of a checkbox in a Kendo UI Grid?

Lee Fuller

So I've searched many of the answers and can't seem to find anything specific on this... so here goes..

I have a standard Kendo UI Grid - and I've setup a column as follows:

{   title: "Sharing Enabled?", 
    field: "permissions_users_apps_user_sharing", 
    attributes: {
        style: "text-align: center; font-size: 14px;"
    },
    filterable: true,
    headerAttributes: {
        style: "font-weight: bold; font-size: 14px; width: 40px;"
    },
    template: function(dataItem) {
        if ( dataItem.permissions_users_apps_user_sharing == 0 ) {
            return "<input type='checkbox' name='permissions_users_apps_status' id='permissions_users_apps_status' value='1' />"
        } else if ( dataItem.permissions_users_apps_user_sharing == 1 ) {
            return "<input type='checkbox' name='permissions_users_apps_status' id='permissions_users_apps_status' value='1' checked />"
        }
    }
},

What I'm trying to do is get the value of this checkbox (to see if it's changed) when I click a COMMAND button I've defined. The ROW is selectable.. so I can get the row's ID. But I can't seem to gather the value of the checkbox.

Anyone have suggestions?

Thanks in advance..

Subbu

You can get the instance of checkbox in dataBound event when the checkbox state changes. See if the below code helps you.

 ....
 columns: [
 {
  { field: "select", template: '<input id="${BindedColumn}" onclick="GrabValue(this)" type="checkbox"/>', width: "35px", title: "Select" },
 }
 ....
 selectable: "multiple, row",
 dataBound: function () {
            var grid = this;
            //handle checkbox change
            grid.table.find("tr").find("td:nth-child(1) input")
            .change(function (e) {
                var checkbox = $(this);
                //Write code to get checkbox properties for all checkboxes in grid
                var selected = grid.table.find("tr").find("td:nth-child(1) input:checked").closest("tr");

                //Write code to get selected checkbox properties
                ......
                //Code below to clear grid selection
                grid.clearSelection();
                //Code below to select a grid row based on checkbox selection 
                if (selected.length) {
                    grid.select(selected);
                }
            })
        }
        .....
        function GrabValue(e)
        {
         //Alert the checkbox value
         alert(e.value);
         //get the grid instance
         var grid = $(e).closest(".k-grid").data("kendoGrid");
         //get the selected row data
         var dataItem = grid.dataSource.view()[grid.select().closest("tr").index()];
         }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

kendo grid How to get a row by field value

From Dev

How to get kendo grid filed value?

From Dev

How to select checkbox at kendo grid?

From Dev

Kendo UI Grid Checkbox Column Field Not Defined

From Dev

How to change the default value of Grid page size in Kendo UI?

From Dev

how to check and change color of cell value in kendo ui grid

From Dev

How to get column total of Kendo-UI grid column (calculated)

From Dev

How to get column total of Kendo-UI grid column (calculated)

From Dev

How to get group by column value in group footer template in kendo grid

From Dev

How to get the value from kendo grid template textboxes to angular array

From Dev

How to get a kendo grid on a kendo template

From Dev

Kendo UI Grid Get Row Values

From Dev

Kendo UI Grid Get Row Values

From Dev

Make k-checkbox visible within a Kendo UI Grid

From Dev

Kendo UI data grid: How to change column display value based on status flag integer value

From Dev

How to value a checkbox in the Gijgo grid?

From Dev

How to set kendo UI grid width

From Dev

How to hide the grid header kendo ui?

From Dev

How to modify Filter in Kendo UI Grid?

From Dev

How to load manually data in kendo ui grid

From Dev

How to set kendo UI grid width

From Dev

Get value of property in editor template of kendo grid

From Dev

Kendo Grid get property value with type in ClientTemplate

From Dev

How to add Kendo WYSIWYG Editor to a Kendo UI Grid Column?

From Dev

Kendo UI, How to manually call validate() on kendo grid cell

From Dev

Kendo UI, How to manually call validate() on kendo grid cell

From Dev

How to set default value for any field of a ViewModel using Kendo UI Grid and ASP.NET MVC?

From Dev

How to pass hardcoded string value from javascript onclick with template option using kendo ui grid?

From Dev

How to get the first row corresponding cell value if i change the other rows cell value in kendo child grid

Related Related

  1. 1

    kendo grid How to get a row by field value

  2. 2

    How to get kendo grid filed value?

  3. 3

    How to select checkbox at kendo grid?

  4. 4

    Kendo UI Grid Checkbox Column Field Not Defined

  5. 5

    How to change the default value of Grid page size in Kendo UI?

  6. 6

    how to check and change color of cell value in kendo ui grid

  7. 7

    How to get column total of Kendo-UI grid column (calculated)

  8. 8

    How to get column total of Kendo-UI grid column (calculated)

  9. 9

    How to get group by column value in group footer template in kendo grid

  10. 10

    How to get the value from kendo grid template textboxes to angular array

  11. 11

    How to get a kendo grid on a kendo template

  12. 12

    Kendo UI Grid Get Row Values

  13. 13

    Kendo UI Grid Get Row Values

  14. 14

    Make k-checkbox visible within a Kendo UI Grid

  15. 15

    Kendo UI data grid: How to change column display value based on status flag integer value

  16. 16

    How to value a checkbox in the Gijgo grid?

  17. 17

    How to set kendo UI grid width

  18. 18

    How to hide the grid header kendo ui?

  19. 19

    How to modify Filter in Kendo UI Grid?

  20. 20

    How to load manually data in kendo ui grid

  21. 21

    How to set kendo UI grid width

  22. 22

    Get value of property in editor template of kendo grid

  23. 23

    Kendo Grid get property value with type in ClientTemplate

  24. 24

    How to add Kendo WYSIWYG Editor to a Kendo UI Grid Column?

  25. 25

    Kendo UI, How to manually call validate() on kendo grid cell

  26. 26

    Kendo UI, How to manually call validate() on kendo grid cell

  27. 27

    How to set default value for any field of a ViewModel using Kendo UI Grid and ASP.NET MVC?

  28. 28

    How to pass hardcoded string value from javascript onclick with template option using kendo ui grid?

  29. 29

    How to get the first row corresponding cell value if i change the other rows cell value in kendo child grid

HotTag

Archive