Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2010
    Location
    Atlanta, GA
    Posts
    38
    Vote Rating
    0
    RoyW is on a distinguished road

      0  

    Default [FIXED-1015] store.loadData( myData, true) causes render bug if records are replaced

    [FIXED-1015] store.loadData( myData, true) causes render bug if records are replaced


    Ext version tested:
    • Ext 3.2.1


    Adapter used:
    • ext


    css used:
    • only default ext-all.css




    Browser versions tested against:
    • ____
    • IE8
    • FF3.5.9 (firebug 1.5.4 installed)
    • Safari 4.0.3
    • Google Chrome 5.0.375.55


    Operating System:
    • ________
    • WinXP Pro


    Description:
    • I am trying to update data records in a store. If I use loadData(myData, true)
      and myData is a single new record then everything works. However if myData is a replacement record (has the same id as a record already in the store) then an error is encountered when the grid tries to re-render the data.


    Test Case:

    Code:
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Stateful Array Grid Example</title>
    
        <!-- ** CSS ** -->
        <!-- base library -->
        <link rel="stylesheet" type="text/css" href="http://www.extjs.com/deploy/dev/resources/css/ext-all.css" />
                       
    
        <style type=text/css>
            /* style rows on mouseover */
            .x-grid3-row-over .x-grid3-cell-inner {
                font-weight: bold;
            }
        </style>
    
        <!-- ** Javascript ** -->
        <!-- ExtJS library: base/adapter -->
        <script type="text/javascript" src="http://www.extjs.com/deploy/dev/adapter/ext/ext-base.js"></script>
    
        <!-- ExtJS library: all widgets -->
        <script type="text/javascript" src="http://www.extjs.com/deploy/dev/ext-all-debug.js"></script>
        <script type="text/javascript">
    /*!
     * Ext JS Library 3.2.1
     * Copyright(c) 2006-2010 Ext JS, Inc.
     * licensing@extjs.com
     * http://www.extjs.com/license
     */
    Ext.onReady(function(){
    
        // sample static data for the store
        var myData = [
            {
                'id' : 1001,
                'company' : 'Alcoa Inc',
                'price' : 29.01,
                'change' : 0.42,
                'pctChange': 1.47,
                'lastChange' : '9/1 12:00am'
            },
            {
                'id' : 1002,
                'company' : 'Altria Group Inc',
                'price' : 83.81,
                'change' : 0.28,
                'pctChange': 0.34,
                'lastChange' : '9/1 12:00am'
            },
            {
                'id' : 1003,
                'company' : 'Wal-Mart Stores, Inc.',
                'price' : 45.45,
                'change' : 0.73,
                'pctChange': 1.63,
                'lastChange' : '9/1 12:00am'
            }
        ];
    
        var newRecord = {
            'id' : 1004,
            'company' : 'Verizon Communications',
            'price' : 35.57,
            'change' : 0.39,
            'pctChange': 1.11,
            'lastChange' : '9/1 12:00am'
        };
    
        var updateRecord = {
            'id' : 1001,
            'company' : 'Alcoa Inc',
            'price' : 29.04,
            'change' : 0.45,
            'pctChange': 1.50,
            'lastChange' : '9/1 12:20am'
        };
    
        // create the data store
        var store = new Ext.data.Store({
            reader : new Ext.data.JsonReader({
                idProperty : 'id',
                fields: [
                   {name : 'id'},
                   {name: 'company'},
                   {name: 'price', type: 'float'},
                   {name: 'change', type: 'float'},
                   {name: 'pctChange', type: 'float'},
                   {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
                ]
            })
        });
        // manually load local data
        store.loadData(myData);
    
        // create the Grid
        var grid = new Ext.grid.GridPanel({
            store: store,
            columns: [
                {id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'},
                {header: 'Price', width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
                {header: 'Change', width: 75, sortable: true, dataIndex: 'change'},
                {header: '% Change', width: 75, sortable: true, dataIndex: 'pctChange'},
                {header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
            ],
            stripeRows: true,
            autoExpandColumn: 'company',
            height: 350,
            width: 600,
            title: 'Grid Bug',
            bbar : [
                {
                    text : "Add new record",
                    handler : function(){
                        store.loadData(newRecord, true);
                    }
                },
                {
                    text : "Update record",
                    handler : function(){
                        store.loadData(updateRecord, true);
                    }
                }
            ]
        });
    
        // render the grid to the specified div in the page
        grid.render('grid-example');
    });        
        </script>
    
    
    </head>
    <body>
    
        <div id="grid-example"></div>
    </body>
    </html>

    See this URL :
    http://www.jsfx.com/extjs/gridbug/index.html


    Steps to reproduce the problem:
    • Run the above example
    • Click on the "Add new record" button - works OK
    • Click on the "Update record" button - error occurs and the grid does not re-render


    The result that was expected:
    • The first record in the grid should be updated


    The result that occurs instead:
    • No update


    Debugging already done:
    • Debugged into loadData() - the record gets inserted (replaced the old record)
    • the bug occurs in doRender of the grid
    • It is trying to render startRow=3, endRow=3 and is being passed an array of 2 records, the first
      record in the array is [undefined]


    Possible fix:
    • not provided

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,951
    Vote Rating
    636
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    A fix for this has been added to SVN.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User Mjollnir26's Avatar
    Join Date
    Oct 2008
    Location
    Germany
    Posts
    152
    Vote Rating
    0
    Mjollnir26 is on a distinguished road

      0  

    Default Where exactly lies the Fix?

    Where exactly lies the Fix?


    Can't seem to locate it in the Commit-Log and don't have the Time to search all divs since 3.2.1 and SVN.
    Got a little hint for me?

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    45
    Vote Rating
    0
    ivaylo.bakalov is on a distinguished road

      0  

    Default


    The SVN repository seems to be stuck in time. The date of the last check-in is June 6th.

  5. #5
    Sencha User
    Join Date
    Jun 2010
    Posts
    4
    Vote Rating
    0
    t.oberthanner is on a distinguished road

      0  

    Default


    hi,

    where do i find the bug fix? pleeease ;-)

    thank you

  6. #6
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    45
    Vote Rating
    0
    ivaylo.bakalov is on a distinguished road

      0  

    Default


    I think it is revision: 6713, path: /branches/ext-3.3.x/src/data/Store.js

  7. #7
    Sencha User
    Join Date
    Jun 2010
    Posts
    4
    Vote Rating
    0
    t.oberthanner is on a distinguished road

      0  

    Default


    Quote Originally Posted by ivaylo.bakalov View Post
    I think it is revision: 6713, path: /branches/ext-3.3.x/src/data/Store.js
    thank you very much for this fast response, but i am not allowed to access
    https://svn.extjs.com/svn/ext/
    is there any other way to get this bugfix?

  8. #8
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    45
    Vote Rating
    0
    ivaylo.bakalov is on a distinguished road

      0  

    Default


    You would have to buy Support Subscription or wait for 3.3 relase.

  9. #9
    Sencha User
    Join Date
    Jun 2010
    Posts
    4
    Vote Rating
    0
    t.oberthanner is on a distinguished road

      0  

    Default


    Thank you for this information!

  10. #10
    Ext JS Premium Member
    Join Date
    Mar 2010
    Location
    Atlanta, GA
    Posts
    38
    Vote Rating
    0
    RoyW is on a distinguished road

      0  

    Default


    I have downloaded ext-3.3-beta1-6976 and run the test again. I do not get any errors, the record is inserted into the store but the grid does not render the new value.

Similar Threads

  1. Replies: 5
    Last Post: 2 May 2011, 2:39 PM
  2. [FIXED] Bug in MessageBox.setClosable(true) ?
    By majain in forum Ext GWT: Bugs (1.x)
    Replies: 1
    Last Post: 27 Oct 2008, 8:41 AM
  3. Ext.data.Store.loadData() append new records in a strange way!
    By Surgeon in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 Aug 2008, 6:01 AM
  4. [2.1][FIXED] Store.loadData does not fire "load" event
    By mcurrey in forum Ext 2.x: Bugs
    Replies: 4
    Last Post: 22 Jul 2008, 11:25 AM
  5. After rendering grid, loadData doesn't paint new records
    By booshan in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 5 Apr 2007, 2:15 PM

Thread Participants: 4