Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Load on Demand - custom datasource
posted

Hi,

I am using the TreeGrid with Load on Demand, but i need to be able to have a custom url (to send parameters up to the server), so i am using the TreeHierarchicalDataSource. This works ok for the top level but doesn't work when i expand a node.

Below is the code i am using. Basically the customEncodeUrlFunc function does not fire. What i am doing wrong? 

var ds = new $.ig.TreeHierarchicalDataSource({
    dataSource: window.applicationRootUrl + "api/reporting/instancetreegrid/toplevel?reportingClassId=" + topLevelReportingClassId,
    treeDS: {
        customEncodeUrlFunc: function (data, isExpanded) {
            return window.applicationRootUrl + "api/reporting/instancetreegrid/child?reportingClassId=" + data.reportingClassId.toString() + "&niceName=" + data.NiceName;
        }
    }
});

$("#instanceSelectorOptions").igTreeGrid({
    dataSource: ds,
    dataSourceType: "json",
    autoGenerateColumns: false,
    columns: [
        {
            key: "niceName",
            dataType: "string",
            headerText: "Instance Names",
            width: '100%',
            allowFiltering: true
        }
    ],
    width: '100%',
    height: '390px',
    enableRemoteLoadOnDemand: true,
    primaryKey: 'id',
    childDataKey: 'childInstances',
    // responseDataKey is the property to look in to get the list when we expand a node.
    // Doesn't seem to be used when rendering the top level and we just return a list.
    responseDataKey: 'childInstances'
});

Cheers ... Rob.