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.
Hello Rob,
The primary key is required to be in the columns definition, because the definition is used to form the data source schema, and without the primary key the data source won't work properly.
Flat data, or self-referencing data, consists of a simple object array where a primary key/foreign key relationship exists in the schema of the data.
Hi Rob,
I apologize for the delayed response. I'm glad to hear you were able to get this working by adding a primary key column.
Some data related features depend on having the primary key as a column to identify the rows correctly. I am not sure if it is actually required for this scenario. I am following up with the team responsible for the igTreeGrid for more information on this.
If you have any further questions or concerns, please let me know.
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 });
Can anybody help me with this ?
Hope you get some reply to this. I am having similar issue, and watching this in hopes that a solution comes up.