Reputation: 149068
How do I get the reference to the JavaScript object representing a dgrid instance. Consider this code:
var MyGrid = var EntityList = declare("ui.MyGrid", [List, Pagination], { ... });
var grid = new MyGrid();
domConstruct.place(grid.domNode, container);
grid.startup();
It's easy enough to access grid
here because it's created programmatically, but if it's created declaratively, as in:
<div id="grid" data-dojo-type="ui.MyGrid" data-dojo-props="...">
dojo.byId('grid')
returns the DOM node.dijit.byId('grid')
returns undefined
.data-dojo-id
apparently has no effect.How do I get a reference to the the actual javascript object behind #grid
?
Upvotes: 2
Views: 1124
Reputation: 7852
Your grid needs to mixin the dgrid/extensions/DijitRegistry
extension. Grids with this extension will register themselves with the dijit registry so you can use dijit.byId('grid')
.
See https://github.com/SitePen/dgrid/wiki/DijitRegistry for more information.
Upvotes: 6