I am trying to style rows using dgrid with Tree extension. For this, I use aspect.after as suggested in https://github.com/SitePen/dgrid/issues/380 and it works well if you do not use Tree extension.
But with Tree extension the grid is rendered when the constructor finished, so aspect.after has no effect.
My code is:
require([
'dojo/_base/declare',
'dgrid/OnDemandGrid',
'dgrid/Tree',
'dgrid/Keyboard',
'dgrid/Selection',
'dstore/Memory',
'dojo/aspect',
'dstore/Tree',
'dgrid/extensions/ColumnResizer',
'dojo/domReady!'
], function (declare,OnDemandGrid, tree, Keyboard, Selection, Memory,aspect,TreeStore,ColumnResizer) {
var dataStore = new (declare([ Memory, TreeStore ]))({ data: $jsonData });
var CustomGrid = declare([ OnDemandGrid, tree, Keyboard, Selection, ColumnResizer ]);
var columns = $jsonHeadTitles;
columns[0][0] = tree(columns[0][0]);
var grid = new CustomGrid({
className: 'dgrid-autoheight',
collection: dataStore.filter( { parent: 0 }),
columns: columns,
noDataMessage: 'Sin registros',
shouldExpand: function(){ return true; },
selectionMode: 'single',
cellNavigation: false,
formatterScope: { html: function(item){ return item; }}
}, '$nombre');
aspect.after(grid, 'renderRow', function(row, args) {
var object = args[0];
if (!empty(object.parent)) {
row.className += ' gridchildren';
}
return row;
});
grid.on('dgrid-error', function(event) {
console.error(event.error.message);
});
});
How can we style rows using Tree extension?
Regards,