Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User renku's Avatar
    Join Date
    Feb 2009
    Location
    Estonia
    Posts
    437
    Vote Rating
    17
    renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold

      0  

    Default [OPEN-1461] Why does Store.datachanged trigger refreshing of GridView headers?

    [OPEN-1461] Why does Store.datachanged trigger refreshing of GridView headers?


    From the source of GridView.js:

    Code:
        onDataChange : function(){
            this.refresh(true); // "true" was added in Ext 3.3
            this.updateHeaderSortState();
            this.syncFocusEl(0);
        },
    
        refresh : function(headersToo) {
            this.fireEvent('beforerefresh', this);
            this.grid.stopEditing(true);
    
            var result = this.renderBody();
            this.mainBody.update(result).setWidth(this.getTotalWidth());
            if (headersToo === true) {
                this.updateHeaders();
                this.updateHeaderSortState();
            }
            this.processRows(0, true);
            this.layout();
            this.applyEmptyText();
            this.fireEvent('refresh', this);
        }
    This means that each time the store is loaded/filtered/sorted, GridView header is completely re-rendered. But I don't see how grid header could be effected by those changes in store.

    I'm currently trying to get my FilterRow plugin to fully work with Ext 3.3. The plugin inserts some form fields into grid header, but the fact that each filtering of the store re-creates grid header makes my task quite hard. I have been coding circles around this thing, but correctly re-inserting and re-focusing the fields and pleasing IE at the same time hasn't been successful so far.

    But when I simply override GridView.onDataChange:

    Code:
        gridView.onDataChange = function(){
            this.refresh(); // removed "true"
            this.updateHeaderSortState();
            this.syncFocusEl(0);
        };
    then all my problems seem to disappear.

    So my question is: Is there some strong argument for refreshing grid headers after store "datachanged" event?

  2. #2
    Sencha User renku's Avatar
    Join Date
    Feb 2009
    Location
    Estonia
    Posts
    437
    Vote Rating
    17
    renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold

      0  

    Default


    As nobody seems to have any opinions on this, I'll assume it's a bug (not feature) in Ext and override it with a fix in my plugin.

  3. #3
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    This must have been required to make PivotGrid work. If you're not seeing any side effects with an override then I'd go for that...
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  4. #4
    Sencha User renku's Avatar
    Join Date
    Feb 2009
    Location
    Estonia
    Posts
    437
    Vote Rating
    17
    renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold

      0  

    Default


    You are correct. PivotGrid fails to render its headers when I take the refresh(true) away.

    For now I'm still staying with the override, as that's the only working solution I currently have (better to have the plugin working only with plain GridPanel than not working at all).

    Thanks for the clarification.

  5. #5
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    Glad that helps. We're doing a lot of restructuring of Grid code in Ext JS 4 which should alleviate problems like these
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  6. #6
    Sencha User
    Join Date
    Sep 2010
    Posts
    51
    Vote Rating
    2
    ExTriqui is on a distinguished road

      0  

    Default


    I found a related bug.
    The headers won't be renderer at all (cause onDataChange is not fired) when the store is created like this:
    Code:
    /*!
     * Ext JS Library 3.3.1
     * Copyright(c) 2006-2010 Sencha Inc.
     * licensing@sencha.com
     * http://www.sencha.com/license
     */
    Ext.onReady(function() {
        var customData = {
        "rows": [{
            "id": 1,
            "product": "Ladder",
            "city": "London",
            "state": "NY",
            "quantity": 5568,
            "value": 17,
            "month": 11,
            "quarter": 3,
            "year": 2010,
            "person": "Jamie Avins"
        },
        {
            "id": 2,
            "product": "Spanner",
            "city": "San Francisco",
            "state": "TX",
            "quantity": 7639,
            "value": 43,
            "month": 4,
            "quarter": 3,
            "year": 2010,
            "person": "Ed Spencer"
        }]};
    
        var SaleRecord = Ext.data.Record.create([
            {name: 'person',   type: 'string'},
            {name: 'product',  type: 'string'},
            {name: 'city',     type: 'string'},
            {name: 'state',    type: 'string'},
            {name: 'month',    type: 'int'},
            {name: 'quarter',  type: 'int'},
            {name: 'year',     type: 'int'},
            {name: 'quantity', type: 'int'},
            {name: 'value',    type: 'int'}
        ]);
        
        var myStore = new Ext.data.Store({
            //url: 'simple.json',
            //autoLoad: true,
            data: customData,
            reader: new Ext.data.JsonReader({
                root: 'rows',
                idProperty: 'id'
            }, SaleRecord)
        });
        
        var pivotGrid = new Ext.grid.PivotGrid({
            title     : 'PivotGrid example',
            width     : 800,
            height    : 259,
            renderTo  : 'docbody',
            store     : myStore,
            aggregator: 'sum',
            measure   : 'value',
            
            viewConfig: {
                title: 'Sales Performance'
            },
            
            leftAxis: [
                {
                    width: 80,
                    dataIndex: 'person'
                },
                {
                    width: 90,
                    dataIndex: 'product'
                }
            ],
            
            topAxis: [
                {
                    dataIndex: 'year'
                },
                {
                    dataIndex: 'city'
                }
            ]
        });
    });
    Example modified from -> http://dev.sencha.com/deploy/dev/exa...grid/simple.js

  7. #7
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    Thanks, I've created a bug ticket for this
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

Similar Threads

  1. [FIXED-189] Store 'datachanged' even firing twice
    By tobinharris in forum Sencha Touch 1.x: Bugs
    Replies: 5
    Last Post: 3 Sep 2010, 11:38 PM
  2. Replies: 3
    Last Post: 3 Sep 2010, 6:28 PM
  3. [FIXED-189] Store 'datachanged' even firing twice
    By tobinharris in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 23 Jul 2010, 5:01 AM
  4. Event datachanged of store
    By anhkpb in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 16 Jul 2009, 2:41 AM

Thread Participants: 2

Tags for this Thread