PDA

View Full Version : Add Record Button in Grid GroupHeaderTpl Alignment



quizzl
25 Nov 2011, 5:31 AM
Hello I created a Grid that is always grouped and I needed a button in the group header to add specific types to the grouped section.

I added an html button to the group header that I used css style float to align it to the right.



var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
groupHeaderTpl: '{name} <input type="image" style="float:right;" src="ext/examples/shared/icons/fam/add.png" value="add{name}" onClick="addBlock(this);">',
enableNoGroups: false
});

The problem is

1. In firefox the alignment is not inline with the header text, in IE it is inline.

2. How can I remove the section expand/collapse event on click from the groupheader as I do not want this to fire when the user clicks on the Add button. The collapse event should only fire when someone clicks on the Header or the +/- symbol.

mitchellsimoens
25 Nov 2011, 6:46 AM
This is going to be your CSS
There is no before event that you can cancel or config to turn that part off. You would have to create an override that I would override the onGroupClick on the Grouping feature and stop it there if it's not on the expand/collapse icon.

quizzl
25 Nov 2011, 7:14 AM
I guess that should work.

zlevardy
27 Aug 2012, 8:14 AM
And where is addBlock(this); method is defined? I am not able to get input onclick to be fired. Console echo works, onclick not.

thx



features: [ Ext.create('Ext.grid.feature.Grouping',{
groupHeaderTpl:
Ext.create('Ext.XTemplate',
' {[this.groupSelect()]}: <input type="button" onclick="this.groupSelect()" value="select"> {name} ',
{
groupSelect: function(value) { console.log('tpl grp sel: '+value); }
}
),