jquery - Kendo grid not populating json data -


here how have created kendo grid

var grid = $("#grid").kendogrid({     autobind:true,     datasource: {         transport: {             read: {                 url: "getfacettree?action=datagrid",                 datatype: "json"             }         },          schema: {             model: {                 fields: {                     details: { type: "number" },                     date: { type: "string" },                     authorsender: { type: "string" },                     recipients: { type: "string" },                     subjectfilename: { type: "string" },                     action: { type: "string" }                 }             }         },         pagesize: 10,         serverpaging: true,         serverfiltering: true,         serversorting: true     },     height: 250,     sortable: {         mode: "multiple",         allowunsort: true     },     filterable: {         extra: false,         operators: {             string: {                 startswith: "starts with",                 eq: "is equal to",                 neq: "is not equal to"             }         }     },     columnmenu: true,     resizable: true,     pageable: {         input: true,         numeric: false,         pagesizes: true,         messages: {             display: "{2} - documents found, displaying {0} {1}"         }     },     editable: true,     columns: [         {             field: "",         title: "<input id='headercheckbox' onclick='selectrows(this)' type='checkbox' name='selected' />",         width: 21,         template: "<input class='rowcheckbox' type='checkbox' name='selected' />"         },         {             field: "details",             title: "details",             width: 50         },         {             field: "date",             title: "date",             width: 100         },         {             field: "authorsender",             title: "author/sender",             width: 150         },         {             field: "recipients",             title: "recipients",             width: 150             /*filterable: false*/         },         {             field: "subjectfilename",             title: "subject/filename",             width: 150         },         {             field: "action",             title: "action",             width: 60         }     ]  }); 

the response getting datasource -

[{ details : 1,  date : "12-06-2000",    authorsender : "sd",    recipients : "we",    subjectfilename : "abc abc.url",    action : "view"},{ details : 1,  date : "12-06-2000",    authorsender : "sd",    recipients : "we",    subjectfilename : "abc abc.url",    action : "view"}] 

but response not updated in grid. there doing wrong?

analysis in firebug(net tab) shows has 5 tabs - params, headers, response, cache, xml, cookies.
under xml tab getting (maybe wrong) -

xml parsing error: syntax error location: moz-nullprincipal:{c48e084c-70a2-4462-8411-0a950e5325d9} line number 1, column 1:  [{ details : 1,  date : "12-06-2000",    authorsender : "sd",    recipients : "w... 

there 2 mistakes:
1. key field in json response should have quotes around.
2. under schema had parse string reponse json below

schema: {     model: {         fields: {             details: { type: "string" },             ...             action: { type: "string" }         }     },     parse: function(response) {         return $.parsejson(response);     } }, 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -