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
60
IgTreeGrid Selected row issues
posted

Hi There, 

I'm using the Tree Grid to display some recursive hierarchical data, but the Selection API doesn't appear to work when selecting the nested rows. 

Can you please give me an example of this working? I actually need the DATA of the selected row. 

The documentation doesn't go in to this as its inherited from the igGrid and this doesn't deal with hierarchical data.

My grid code: 

$("#treeGrid").igTreeGrid({
width: "100%",
height: w,
dataSource: data,
dataSourceType: 'json',
autoGenerateColumns: false,
columns: [
{
key: "name",
headerText: "Name",
dataType: "string",
width: 550,
template: "<span> <img src='${iconPath}' /> &nbsp; ${name} </span>"
},
{ key: "weight", headerText: "Weight", dataType: "string" },
{ key: "ccy", headerText: "CCY", dataType: "string" },
{ key: "type", headerText: "Type", dataType: "string" },

//Leave this in... it doesn't render the icon in the template if the path isn't bound to something
{ key: "iconPath", headerText: "Icon", dataType: "string", hidden: true },
{ key: "id", headerText: "Id", dataType: "string", hidden: true },
],
childDataKey: 'constituents',
renderExpandColumn: true,
initialExpandDepth: 0,
features: [
{
name: "Selection",
multipleSelection: false,
activation: true,
rowSelectionChanged: function (evt, ui) {

//nothing in this method, or any inspection of the objects reveals any way to get the data of the selected nested row

var grid = $('#treeGrid');
var row = $('#treeGrid').igTreeGrid('selectedRow');
var activeRow = $('#treeGrid').igTreeGrid('activeRow');
var data = $('#treeGrid').data('igTreeGrid').dataSource.dataView();
var dataRow1 = ui.row.element.data;
var dataRow = ui.row.element.data();

var selectedData = data[row.index];

}
},
]
});

Many thanks, 

Matt

Parents
  • 3995
    Offline posted

    Hello Matt,

    Thank you for posting into our community!

    Actually the ui.row parameter is returning the information you require.

    Here's a fiddle to demonstrate this, please let me know if it helps.

Reply Children