Hi
I am trying to set the column format in the hierarchical grid but I fail to get the format to apply and I do not get any error messages explaining what I am doing wrong. The following is a snipplet of my code.
Best Regards
Fredrik
var jsonSchema = new $.ig.DataSchema("json", { fields: [topLevel.metaData.fields] });
module.setDataSource = function (data, tableId, jsonSchema ) { $("#" + tableId).igHierarchicalGrid({ width: "100%", dataSource: data, animationDuration: 100, dataRendering: module.hierarchicalGridRendering,schema: jsonSchema , features: [ { name: 'Paging', type: "local", showPageSizeDropDown: false, pageSize: 80 }, { name: "Resizing" } ], autoGenerateLayouts: true }); };
Where the json structure looks something like this:
topLevelMetaData { schema { fields[0] { {name: someName, type: someType}, ..., {name: someName, type: someType}}}}
Hello Fredrik,
Thank you for posting in our forum.
You can refer to the following article from our documentation that explains how the column and layouts have to be set:
http://help.infragistics.com/doc/jQuery/2013.2/CLR4.0/?page=igHierarchicalGrid_Columns_and_Layouts.html
What seems to be missing in your example is the childrenDataProperty for the main grid which should correspond to the property name from which the child data should be retrieved from.
Also responseDataKey and searchField are used when your json data is wrapped in another object. For example:
var adventureWorks = {
"Records": [{
"ProductID": 1,
"Name": "Adjustable Race",
"ProductNumber": "AR-5381"
}, {
"ProductID": 2,
"Name": "Bearing Ball",
"ProductNumber": "BA-8327"
}
]};
In the upper example the data is wrapped in an object “Records”.
In that case it’s necessary to set the responseDataKey and searchField in order for the grid to know form which object to get its data. Otherwise they should be empty.
I’ve attached an example for your reference. Let me know if you have any questions.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Hi again Maya,
I managed to fix the issues I were having and now the grid is rendering correctly. Thank you for the instructive example.
I have one more question though. How do you applay templates to the hierarchical grid. Do you set a template variable in the columnLayout on the specific column?
Hello Fredrik ,
I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.
Developer Support Engineer
There’re row templates and column templates.
The rowTemplates need to be defined for the specific layout to which you want to apply the template.
They’re set via the “rowTemplate” option.
There’s an example of how to set a row template here:
http://www.igniteui.com/grid/row-template
The column template is defined inside the column definition via a “template” options. For example:
{ headerText: "", key: "Delete", dataType: "string", width: "20%", unbound: true, template: "<input type='button' onclick='deleteRow(${ProductID})' value='Delete row' class='delete-button'/>" }
This will be applied only to the specific column from that specific layout.
There’re an example you can refer to here:
http://www.igniteui.com/grid/column-template
Let me know if you have any questions.