1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    ireneyip is on a distinguished road

      0  

    Default DataGrid not being re-rendered automatically after store's record has changed

    DataGrid not being re-rendered automatically after store's record has changed


    We just upgraded from ExtJS 4.1 to 4.2 and saw an issue with GridPanel auto re-rendering when store's record data gets changed programmatically.
    In Ext 4.1, when we update the store's record with record.set ('field_name', new_value), the grid will re-render itself automatically showing the updated data. In Ext4.2, this is no longer happening.

    As a workaround, we now need to bind to store's update event, and manually re-render the grid by
    grid.getView().refresh().

    Is this expected behavior or is this a bug?
    As I compare ExtJS 4.1 and 4.2, it looks like in both cases, the datachanged event is fired once and only once when the store was initially loaded with server data (not fired again when we do record.set), so datachanged event firing does not seem to be the issue that is causing this difference in grid rendering behavior.

  2. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,735
    Vote Rating
    104
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    Need a test case to know for sure, but if you review the grid internal code it's trying to be very very smart about things and only update cells where a particular Model field (defined as dataIndex) is used. The only surefire way to trigger a refresh seems to manually calling onUpdate on the gridView after a record has changed...

    This is the root cause:

    Code:
    shouldUpdateCell: function(record, column, changedFieldNames){
            // Though this may not be the most efficient, a renderer could be dependent on any field in the
            // store, so we must always update the cell.
            // If no changeFieldNames array was passed, we have to assume that that information
            // is unknown and update all cells.
            if (column.hasCustomRenderer || !changedFieldNames) {
                return true;
            }
    
            if (changedFieldNames) {
                var len = changedFieldNames.length,
                    i, field;
    
                for (i = 0; i < len; ++i) {
                    field = changedFieldNames[i];
                    if (field === column.dataIndex || field === record.idProperty) {
                        return true;
                    }
                }
            }
            return false;
        },

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi