p.s.w.g
p.s.w.g

Reputation: 149068

Get instance of dgrid byId

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="...">

How do I get a reference to the the actual javascript object behind #grid?

Upvotes: 2

Views: 1124

Answers (1)

BuffaloBuffalo
BuffaloBuffalo

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

Related Questions