Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created March 26, 2021 11:13
Show Gist options
  • Save AJFaraday/978e5f2800068f64df56d476faca5c7d to your computer and use it in GitHub Desktop.
Save AJFaraday/978e5f2800068f64df56d476faca5c7d to your computer and use it in GitHub Desktop.
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