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

Javascript checkbox submit to DataSource read

0 Answers 6 Views
CheckBox
This is a migrated thread and some comments may be shown as answers.
yazid
Top achievements
Rank 1
yazid asked on 21 Dec 2018, 01:48 AM

I was newbie in Kendo Ui and also javascript programming. I have a simple question how to submit the value from my checkbox to dataSource transport : read?

so "getData.php" able to get "c1" value (active) and reload the page again.

Here I provide my code? Hope someone can help me. Thank You.

My checkbox :

<input type="checkbox" id="c1" name="checkbox1" class="k-checkbox" checked="checked"  value="active" onclick="checkBox()">

 

Javascript code for checkbox:

$(function() {
    var dataSource = new kendo.data.DataSource({
   transport: {
              read: {
                       url: "/getData.php",
               type: "POST"
              }
              },
                schema: {
                    model: {
                        id: "segmentID"
                              }
              }
    });
});
 
function checkBox() {
     
    var checkbox = document.getElementById("c1");
     
    if (checkbox.checked == true) {

 

        $("#grid").data("kendoGrid").dataSource.read(checkBox.value);
    } else {
        if (checkBox.value == 'active') {
            var x = 'inactive';
        }
        $("#grid").data("kendoGrid").dataSource.read(x);
    }
     
}

No answers yet. Maybe you can help?

Tags
CheckBox
Asked by
yazid
Top achievements
Rank 1
Share this question
or