Hello Good People,
i've been fan of telerix product for so long but honestly this kendo ui has blown my mind. Kudos to the team behind it.I choose kendo over wijmo and pure jquery ui especially because of component as the grid.BUT my first attempt to the grid has turn out be a challenge for me.so many hours trying to figure out why my code is not working. am using,php 5.3.5, kohana 3.2 with mysql jquery 1.7.2., firefox 9.0.1, chrome 20.0.1132.57 m .So am pulling data from mysql . with firebug activated i could not find any reason why my codo should not work. i even copy the code from one of the example file just to be sure am not the cause of it. the data is returned as one would expect , a valid json format string as shown on the attached file. i use northwind database for my trial.
Can anyone give a hand? there is something am not doing right ?
here is a snippet of the clientside file.
here is my php/kohana/mvc action
i've been fan of telerix product for so long but honestly this kendo ui has blown my mind. Kudos to the team behind it.I choose kendo over wijmo and pure jquery ui especially because of component as the grid.BUT my first attempt to the grid has turn out be a challenge for me.so many hours trying to figure out why my code is not working. am using,php 5.3.5, kohana 3.2 with mysql jquery 1.7.2., firefox 9.0.1, chrome 20.0.1132.57 m .So am pulling data from mysql . with firebug activated i could not find any reason why my codo should not work. i even copy the code from one of the example file just to be sure am not the cause of it. the data is returned as one would expect , a valid json format string as shown on the attached file. i use northwind database for my trial.
Can anyone give a hand? there is something am not doing right ?
here is a snippet of the clientside file.
<
div
style
=
"height: 35px"
></
div
>
<
div
id
=
"clientsDb"
>
<
div
id
=
"grid"
></
div
>
</
div
>
<
script
type
=
"text/javascript"
>
$(function(){
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: {url: "read", datatype: "json", contentType: 'application/json'}
},
schema: {
model: {
fields: {
CompanyName: {type: "string"},
ContactName: {type: "string"}
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 250,
filterable: true,
sortable: true,
pageable: true,
columns: [
{field: "CompanyName", title: "Company Name"},
{field: "ContactName", title: "Contact Name"}
]
});
});
</
script
>
here is my php/kohana/mvc action
public function action_read()
{
$query = DB::select("ContactName","CompanyName")->from("customers")->offset(0)->limit(10);
$accounts = $query->execute("northwind");
$toSend = array();
foreach($accounts as $acc){
$toSend[] = $acc;
}
// $data = "{\"results\":". json_encode($toSend)."}";
$data = json_encode($toSend);
$this->auto_render = false;
echo $data;
}