Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
What am I doing wrong
var FolderTree = {
init: function (target_div) {
var me = this;
me.data_source = new kendo.data.TreeListDataSource(
{
transport: {
read: {
url: "/folder/elements",
dataType: "jsonp"
}
},
schema: {
model: {
id: 'id',
parentId: 'parentId',
fields: {
id: {type: 'number', nullable: false},
parentId: {type: 'number', nullable: true}
}
}
}
}
);
me.folder_tree = $(target_div).kendoTreeList(
{
dataSource: me.data_source,
height: '100',
columns: [
{field: "name", expandable: true, title: "Name"},
{field: "state_name", title: "State Name"},
{field: "id"},
{field: "parentId", title: "Parent"}
],
dataBound: function () {
$(target_div + ' > .k-grid-content').css('height', '100%');
}
}
).data('kendoTreeList');
}
};
/*
Server returns correct jsonp data (using params[:callback]) but also I've tried returning plain json.
I can confirm the data is all loaded with this:
$('#folder_tree_div').data('kendoTreeList').dataSource.data();
No rows appear. It just completes as expected then shows an empty grid with "No records to display".
It displays correctly if I just write some data directly into the dataSource.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment