var viewModel = null;
$(document).ready(function(){
//So this would probably get called after an $.ajax success call
createModel(getJSONData());
$(".filterIt").searchCreate({
placeholder: "Filter Column",
width: '137px', // specify pixel width
showSearchIcon: true,
//color: 'dark', // only choice is dark
clearAfterSearch: false,
change: function (e) {
console.log("change " + e);
viewModel.filter();
},
search: function (e) {
}
});
});
function createModel(jsonData){
//Add in custom functions here
viewModel = kendo.observable({
getStatus: function(rotation){
},
filter: function(rotation){
this.getBlocks();
},
getCompletionStatus: function(){
return "hey";
},
getBlocks: function(){
var blocks = this.Blocks;
return blocks;
}
});
//This is how you put the "jsonData" onto the model to be "observable"
for (var field in jsonData) {
viewModel.set(field, jsonData[field]);
}
//Now tell kendo to apply your data to this div in the markup
kendo.bind($("#overview"), viewModel);
}
function getJSONData(){
return {
Blocks: [
{ Name: "Pediatrics", Date: "JAN 2012", Status: 0 },
{ Name: "Psychiatry", Date: "JAN 2012", Status: 2 },
{ Name: "Medicine", Date: "JAN 2012", Status: 1 },
]
}
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.