KendoUI Gantt Chart Expand Event -- lazy loading support

686 Views Asked by At

Kendo ui Gantt Chart has a treeview at the left side and I want to listen expand event.

Main goal is loading summary rows first and when user clicked expand icon loading detail rows (Tasks).

Is there a way to find out which row is expanded and get its data (id maybe), a lazy loading feature?

Thanks.

Kendo with Summary example: http://dojo.telerik.com/arUPu

1

There are 1 best solutions below

0
On BEST ANSWER

I solved with databound. Here is my latest code: Also check telerik forum: http://www.telerik.com/forums/gantt-chart-expand-event-or-lazy-loading-support

var expandedIds = [];
var returnWithInnerDataIdList= [];

ganttChart.bind("dataBound", function(e) {  
     ganttChart.element.find("tr[data-uid]").each(function (e) {
        var dataItem = ganttChart.dataSource.getByUid($(this).attr("data-uid"));

        if (dataItem.expanded == true && jQuery.inArray(dataItem.id, expandedIds) < 0) {
            expandedIds.push(dataItem.id);
            if (dataItem.Level == 3) {
                returnWithInnerDataIdList.push(dataItem.id);
                loadDataWithNewIds();
            }
        }
        else if (dataItem.expanded == false && jQuery.inArray(dataItem.id, expandedIds) >= 0) {
            expandedIds = jQuery.grep(expandedIds, function (value) {
                return value != dataItem.id;
            });
        }
    });
});