super_drone
30 Nov 2007, 2:03 PM
Hi All
This must be something simple but I can't seem to find an answer. I need to render links inside grid cells. Standard Links like edit/delete with ID embedded in them. I know I have to use a custom rendered in the Grid column Model. My question is how do I attach an even handler to the link in my renderer:
function custom_renderer(cell_data, meta_data, record, row_index) {
var edit_link = "<span onclick='click_handler()' id='_edit_" + record.json.id+"'>Edit</span>";
return edit_link;
}
Is above use of onclick recommended? Isn't the 'right' way to attach handlers is via addListerner? Is so, how do I first instantiate the Element so I can call addListener on it? Can I even return an Ext.Element from a renderer or I must return raw html?
There must be an example for this seemingly very common pattern - does anyone have pointers?
Thanks in advance.
This must be something simple but I can't seem to find an answer. I need to render links inside grid cells. Standard Links like edit/delete with ID embedded in them. I know I have to use a custom rendered in the Grid column Model. My question is how do I attach an even handler to the link in my renderer:
function custom_renderer(cell_data, meta_data, record, row_index) {
var edit_link = "<span onclick='click_handler()' id='_edit_" + record.json.id+"'>Edit</span>";
return edit_link;
}
Is above use of onclick recommended? Isn't the 'right' way to attach handlers is via addListerner? Is so, how do I first instantiate the Element so I can call addListener on it? Can I even return an Ext.Element from a renderer or I must return raw html?
There must be an example for this seemingly very common pattern - does anyone have pointers?
Thanks in advance.