PDA

View Full Version : A button without the button frame, just keeping the icon?



Joche
1 Jul 2008, 4:20 AM
(Yes, I have read the whole post about not having buttons on grid-cells, but my design and needs are very well met with having buttons in the grid)

I'm creating a button in a grid-column via the functions below. it works absolute perfect. The only thing is that I would love to just show the icon, not the whole button framework. I'm certainly much more experienced in JS than CSS so if someone could help me out here I would be very grateful.





function createGridButton( value, id, record) {
new Ext.Button( {
cls : 'x-btn-icon'
, icon : '/famfamfam/delete.png'
, tooltip : 'Kopplar bort aktuell kontakt'
,renderTo: id

,handler: function(value1,value2) {
connectedContacts.remove(record);
},
scope : this
});
}

function renderButton( data, cell, record, rowIndex, columnIndex, store, grid) {
if(isineditmode){
var contentId = Ext.id();
createGridButton.defer( 1, this, [ data, contentId, record]);
return '<div id="'+contentId+'" />';
} else {
return '';
}
}

evant
1 Jul 2008, 4:26 AM
So you just want an icon?

Why not just render the image directly?

1 Jul 2008, 4:54 AM
... and add click handlers.

Joche
1 Jul 2008, 5:13 AM
So you just want an icon?

Why not just render the image directly?

That would be awesome, but because this is in a gridcolumn the element wont be rendered in the function that creates the button. I need to do something like myImg = new Ext.Element() to get an object that's not represented in the DOM (yet). If that's possible please guide me to the right classes.

evant
1 Jul 2008, 5:15 AM
Check out the RowActions plugin in the UX forum, it should do what you need.

1 Jul 2008, 5:17 AM
http://extjs.eu

Joche
1 Jul 2008, 6:19 AM
Check out the RowActions plugin in the UX forum, it should do what you need.

Cellactions did what I wanted. (I had been looking on that before but it was a bit overwhelming at the time, my bad.)

Thanks everyone for your help.