ExtJs - how correctly implement the code as an event
I have code:
...
function Edit(id) { ... }
...
view : new Ext.grid.GroupingView({
groupTextTpl : '... <a href="#" onClick="Edit({[values.rs[0].data["id"]]})">link</a>...'
...
Everything works, but it would be something on the similarity:
...
Ext.get('ed开发者_JS百科it').on('click', function() {
alert(this.getValue());
});
...
view : new Ext.grid.GroupingView({
groupTextTpl : '... <a href="#" id="edit" value="{[values.rs[0].data["id"]]}">link</a>...'
...
But for some reason does not work, error - Ext.get ("edit") is null. What am I doing wrong?
Ext.get('edit')
gets called before it is created, hence the error. Put the Ext.get()
below the GroupingView()
精彩评论