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.
Can anybody help me with this ?
Adding a hidden column for the PrimaryKey fixed this. I'm not sure whether or not though you always need the primary key as a column. I cannot find any reference to this in the documentation, but it worked here
var ds = new $.ig.TreeHierarchicalDataSource({ dataSource: window.applicationRootUrl + "api/reporting/instancetreegrid/topnode?cmisName=" + $scope.currentCMIS.pdbName + "&reportingClassId=" + topLevelReportingClassId, treeDS: { customEncodeUrlFunc: function(rowrecord, expand) { return window.applicationRootUrl + "api/reporting/instancetreegrid/leafnode?reportingClassId=" + rowrecord.reportingClassId; } } });
$("#instanceSelectorOptions").igTreeGrid({ dataSource: ds, autoGenerateColumns: false, columns: [ { key: "reportingClassId", dataType: "string", hidden: true }, { key: "niceName", dataType: "string", headerText: chartResources.instancesAvailable, width: '100%', allowFiltering: true } ], width: '100%', height: '390px', enableRemoteLoadOnDemand: true, primaryKey: 'reportingClassId', childDataKey: 'childInstances', responseDataKey: 'childInstances', dataRendered: instanceSelectorOptionsRendered });