Skip to content

Instantly share code, notes, and snippets.

@ziyahan
Created December 5, 2014 09:19
Show Gist options
  • Save ziyahan/ac06f70edf53aca50a83 to your computer and use it in GitHub Desktop.
Save ziyahan/ac06f70edf53aca50a83 to your computer and use it in GitHub Desktop.
var _grid = $("#companies").data("kendoGrid");
$("#companies").data("kendoGrid").dataSource.bind("change", function(e) {
// let's check whether the event is fired by a filter?
var filter = _grid.dataSource.filter();
if(filter) {
console.log("there is a filter now");
/* I know this because I have added a filter to the "id" column when the grid initialized. Nevertheless, we should control whether filter is our predefined filter or not.*/
if(filter.filters[0].field=="id") {
var row = _grid.dataItems()[0];
$("#authorized").val(row.authorized);
$("#telephone").val(row.telephone);
$("#mobile").val(row.mobile);
$("#email").val(row.email);
} else {
//yes, there is a filter but it doesn't not belong to us, so we should do anything
//TODO
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment