开发者

ExtJs - how correctly implement the code as an event

开发者 https://www.devze.com 2023-04-11 06:39 出处:网络
I have code: ... function Edit(id) { ... } ... view : new Ext.grid.GroupingView({ groupTextTpl: \'... <a href=\"#\" onClick=\"Edit({[values.rs[0].data[\"id\"]]})\">link</a>...\'

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

精彩评论

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