1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    0
    quizzl is on a distinguished road

      0  

    Default Unanswered: Add Record Button in Grid GroupHeaderTpl Alignment

    Unanswered: Add Record Button in Grid GroupHeaderTpl Alignment


    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.

    Code:
     
    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.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    873
    Answers
    3567
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    1. This is going to be your CSS
    2. 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.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    0
    quizzl is on a distinguished road

      0  

    Default


    I guess that should work.

  4. #4
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    131
    Vote Rating
    5
    zlevardy is on a distinguished road

      0  

    Default


    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

    Code:
    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); }
    		            		    }
    		        		),

Thread Participants: 2