Hello,
In working with the igHierarchical grid, I'm so far able to display the top-level records. However, as soon as I expand a top-level record I get a javascript error "Object doesn't support property or method 'replace' ".
I'm so close, but I imagine I'm missing something very small.
Firstly, here's a Json data sample returned to the View - and you'll see that the child records stored in "Accounts" array:
[{"Accounts":["0012F","0012MXR","0012C","0012CWU"],"ExtensionData":null,"ConfidenceInterval":0,"LookbackInterval":0,"Margin":0,"entityName":"3D","isAccountLevel":false},{"Accounts":["0056F","0056CHH","0056MNE","0056MQC","0056MON"],"ExtensionData":null,"ConfidenceInterval":0,"LookbackInterval":0,"Margin":0,"entityName":"OBC","isAccountLevel":false}]
Here's my view code :
function DisplayHierarchyGrid(data) {
$("#hierGrid").igHierarchicalGrid({ initialDataBindDepth: 1, // 0 used for load on demand, no child records at first. dataSource: data, dataSourceType: "json", primaryKey: "entityName", height: "300px", width: "600px", autoGenerateColumns: false, autoGenerateLayouts: false, columns: [ { headerText: "Member", key: "entityName", dataType: "string", width: "100px" }, { headerText: "Margin", key: "Margin", dataType: "number", format: "double", width: "120px" }, { headerText: "LI (Days)", key: "LookbackInterval", dataType: "number", format: "number", width: "180px" }, { headerText: "Conf Interval", key: "ConfidenceInterval", dataType: "number", format: "percent", width: "170px" } ], columnLayouts: [{ primaryKey: "AcctName", foreignKey: "entityName", height: "200px", width: "550px", responseDataKey: "", childrenDataProperty: "Accounts", columns: [ { headerText: "Account", key: "AcctName", dataType: "string" }, { headerText: "Margin", key: "Margin", dataType: "number", format: "double" }, { headerText: "Liquidity Interval (Days)", key: "LookbackInterval", dataType: "number", format: "number" }, { headerText: "Confidence Level", key: "ConfidenceInterval", dataType: "number", format: "percent" }, }] }); }
My controller code returns the json object I showed above.
any advise would be appreciated...
thanks.
Bob
Hello Bob M.
I have created a sample that reproduces your issue with the already returned JSON. The rows are expanded correctly. The issue might be caused by inappropriate JSON formatting in the controller, or if you use some additional code in the view part of your project. Please check your JavaScript functions positioned on this view, since they might not handle the events triggered correctly.
Actually I believe I see the problem now. It appears my Accounts array is not properly formatted with the normal Name/Value pair.
I'll have to clean that up in my c# code first before returning that Json data object.
I'll keep you posted...