PDA

View Full Version : Is it possible to insert button into template?



atchijov
29 Jun 2009, 12:34 PM
I have a DataView and I need to be able to add couple buttons to each record. One way of doing it will be to listen to "mousedown" event and then try to figure out which of "buttons" were clicked. I am wondering if there is more "elegant" solution to this problem.

You comments will be highly appreciated

Andrei

4 Jul 2009, 9:15 AM
you can apply generic HTML buttons and use a selector to apply an instance of Ext.Button to each of the html buttons.

simon
19 Jul 2009, 12:36 AM
Do you have some example? I would like to do something similar.

Thank you,
Simon

danh2000
19 Jul 2009, 12:47 AM
Do you have some example? I would like to do something similar.

Thank you,
Simon

Simon,

Just use the applyTo or renderTo configs of Button:

http://extjs.com/deploy/dev/docs/?class=Ext.Button

simon
19 Jul 2009, 1:27 AM
I am using grid with expandable row and this row has template:
http://extjs.com/deploy/dev/examples/grid/grid-plugins.html



var expander = new Ext.ux.grid.RowExpander({
tpl: new Ext.Template(
'<p><input type="button" id="btn{complaintID}"> <b>Company:</b> {company}</p><br>',
'<p><b>Summary:</b> {pname} <input type="text" id="combo{complaintID}"</p>'
'<p><input type="text" id="fileUpload{complaintID}</p>'
)
});

Now I would like to replace this 3 html components with ext button, ext.combobox and ext.fileupload control.
Which event should I use? I tried grid beforerender and store load events, but selector always returns null. Is there some event like row before render?

Do you have some similar example, how to replace html elements in grid or dataview row template with ext components? I was looking for it but without success.

Thank you,
Simon