PDA

View Full Version : Display a button in a cell.



dmayer
3 Nov 2006, 11:41 AM
Jack,

I want to add a button to a cell in each row. I believe I know the answer but I want to double check.

I believe the easiest way is to create a button editor object and assign it to a placeholder column in the grid/datamodel.

Does this sound right to you?

jack.slocum
3 Nov 2006, 12:21 PM
You could add a renderer function as well that returns a button html string.

tvrtko
18 Apr 2007, 11:08 AM
How would you attach a handler to a button created in renderer function?

I can create ID and set a delayed function to call:

Ext.fly(generatedId).on('click', ...);

but I need to remember the id somewhere, and also, delayed execution somehow seems as an unnecessary complication.

Also, there is a question of how to generate the html string for button (not the simple <button>) but the cool Ext kind of button.

I'm currently using an <a> element instead of a button. It has href="javascript:fu" which I would like to replace with el.on('click',...). Same kind of problem, different element...

Tvrtko
__
P.S. In my case, the button/link is not the only thing inside a cell (if that makes any difference to a potentially different solution).

smokeman
20 Sep 2007, 8:04 PM
I need to have a button in a grid row, that fires a function upon buttonclick.

I took a previous grid example, and customized it a bit, using:


grid.on('rowdblclick', function(grid, rowIndex, e) {
var selectedId = ds.data.items[rowIndex].id;
confirmspopup(selectedId);
});
function confirmspopup(year){
//dialog popup
}


so a doubleclick opens a dialog. I need this button in the row to call the same function, passing either the rowIndex, or the value of cell(year),

any ideas?

Thanks,
Barry Smoke


here's a similar thread, leading to a on cell click reference,
http://extjs.com/forum/showthread.php?t=12307&highlight=button+grid+cell&page=2
but I can't figure out how to code this.

would you put a form button in (just like turning any other cell into an editabel cell with ext.form)
then just add a listener to grid.on for the cell click?