Hi.
I am using the igHierarchicalGrid. I have bound it to a tree level datasource. Category->Property->Value. I have a problem with selection feature after expanding rows. If I expand a row in the top most grid (Category 1) selection works as exptected. If I expand a row in the first child (Property 1) grid I can select rows in its child grid (Value 1.1,1.2,1.3), and rows in the top most grid (Category) but not the first child grid (Property 1). If I then expand another row in the first child grid (Property 2) I can select rows in its child grid (Value 2.1,2.2,2.3) but not in any other child grid. activeRowChanged does not fire when i click Property 1 row. I can always select a row in the top most grid.
Basicly I can only make selection in the last expanded value grid and Catagory grid. What am I doing wrong?
Thanks in advance.
Datasource:
{ "List":[ { "CategoryID":1712, "CategoryName":"Category 1", "ObjectType":1, "PropertyList":{ "List":[ { "PropertyID":7329, "PropertyName":"Property 1", "CategoryID":1712, "ValueList":{ "List":[ { "ValueID":230770, "Value":"Value 1.1", "PropertyID":7329 }, { "ValueID":230771, "Value":"Value 1.2", "PropertyID":7329 }, { "ValueID":230772, "Value":"Value 1.3", "PropertyID":7329 } ] } }, { "PropertyID":7330, "PropertyName":"Property 2", "CategoryID":1712, "ValueList":{ "List":[ { "ValueID":230773, "Value":"Value 2.1", "PropertyID":7330 }, { "ValueID":230774, "Value":"Value 2.2", "PropertyID":7330 }, { "ValueID":230775, "Value":"Value 2.3", "PropertyID":7330 } ] } } ] } } ]}
var categoryList = data; $.ig.loader(function () { $("#dgCategory").igHierarchicalGrid({ primaryKey: "CategoryID", width: 270, dataSourceType: "json", height: $("#fsPricelist").height() - 65, autoGenerateColumns: false, responseDataKey: "List", showHeader: false, initialDataBindDepth: -1, initialExpandDepth: -1, dataSource: categoryList.List, columns: [ { key: "CategoryID", dataType: "number", hidden: true }, { key: "CategoryName", headerText: "Category", dataType: "string" } ], autoGenerateLayouts: false, columnLayouts: [ { key: "PropertyList", primaryKey: "PropertyID", foreignKey: "CategoryID", responseDataKey: "List", autoGenerateColumns: false, autoGenerateLayouts: false, showHeader: false, columns: [ { key: "CategoryID", dataType: "number", hidden: true }, { key: "PropertyID", dataType: "number", hidden: true }, { key: "PropertyName", headerText: "Property" } ], columnLayouts: [{ key: "ValueList", primaryKey: "ValueID", foreignKey: "PropertyID", responseDataKey: "List", autoGenerateColumns: false, autoGenerateLayouts: false, showHeader: false, rowTemplate: "<tr><td></td><td></td><td data-datakey='${PropertyID}'>${Value}</td></tr>", columns: [ { key: "PropertyID", dataType: "number", hidden: true }, { key: "ValueID", dataType: "number", hidden: true }, { key: "Value", headerText: "Value" } ] }] }], features: [ { name: "Selection", activeRowChanged: function (evt, ui) { CATEGORY.getSelectedCategory(ui.owner.grid, ui.row); } } ] });
Hello Ludvig,
Can you clarify what version of Ignite UI are you using?
This is really interesting (and not expected) behaviour - the Hierarchical Grid will propagate your handler down to every child Grid. Feature Inheritance is on by default and that means every child has it's separate copy of options which means the handlers are separate and independent and should fire.
I copied over your code and I have no problems selecting at any level - http://jsfiddle.net/damyanpetev/Xd78f/
My best guess is, if you are using older version, perhaps inheritance was not on by default so make sure you add inherit to Selection options:
The other option would be that external Code you run when the event fires - perhaps whatever it does doesn't always work? try replacing it with a simple console log or something to verify the event is still not firing and in that case the best thing you can do is provide us with some sort of isolated sample so we can track down the issue.
P.S. Looking at your data - if you are going to be using the grid for selection only and with just one column, perhaps consider using a Tree? Take a look at this sample - http://es.infragistics.com/products/jquery/sample/tree/selection
Best regards,
Damyan
Hello Damyan.
The version I am using is 2012.2 (12.2.20122.2029). If I use the cdn from your code it works the way it supposed to.
The final result will have more than one column and feature. When I couldn´t get the grid selection to work I removed all columns but one in each grid. That’s the reason for not using a tree. Thanks for the tip anyway.
Thank you for responding,
Ludvig
Hi Ludvig,
Just checked - you should update to the latest Service Release (12.2.20122.2275) where this issue has been resolved - http://jsfiddle.net/damyanpetev/wB6AH/
Newer releases are also an option, of course.
Cheers,