开发者

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜