Results 1 to 9 of 9

Thread: gridPanel.view.refresh() giving hassles

  1. #1
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default gridPanel.view.refresh() giving hassles

    Interesting problem that I've been struggling with this morning. I have a 2 GridPanel's and on the load of a page after some other fun little things happen I want to refresh the view on each grid. Grid1 works with no problems except Grid2 fails with the error: "this.grid is undefined"

    Grid1 declaration:
    Code:
    tsGrid = new Ext.grid.GridPanel({
            cls             : 'timesheetgrid',
            store           : gridStore,
            trackMouseOver  : false,
            border          : false,
            plugins         : [tsActionColumn, completeColumn, new Ext.ux.grid.GridSummary(), tsExpander],
            viewConfig      : {
                listeners       : {
                    refresh         : function(view){
                        addTsGridEvents();
                    }
                }
            },
            //cut out columnModel declaration
    Grid2 declaration:
    Code:
    matGrid = new Ext.grid.GridPanel({
            cls             : 'materialsgrid',
            store           : materialsStore,
            trackMouseOver  : false,
            border          : false,
            plugins         : [matActionColumn, new Ext.ux.grid.GridSummary(), matExpander],
            viewConfig      : {
                listeners       : {
                    refresh         : function(view){
                        addMatGridEvents();
                    }
                }
            },
            // cut out columnModel declaration
    both are called as follows:

    tsGrid.view.refresh();
    matGrid.view.refresh();

    I have added some console.log's in the matGrid.view.refresh function as well but those never fire. Any ideas or suggestions?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    What would cause a need to refresh? That should not be necessary.

  3. #3
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default

    after loading the grids we have functions that run and check if a user has certain rights, based on those rights we assign certain values to custom renderers in the grids and thus the refresh

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Quote Originally Posted by StevenMcD View Post
    after loading the grids we have functions that run and check if a user has certain rights, based on those rights we assign certain values to custom renderers in the grids and thus the refresh


    "assign values to renderers" makes no sense.

    To change data in a GridPanel, you change the data in its Store, and the UI is automatically updated.

    It's an MVC control. The Store is the Model. Update that and the View updates itself.

  5. #5
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default

    the grid has columns and in them we have HTML controls with custom attributes that do not appear in the gridStore.

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Quote Originally Posted by StevenMcD View Post
    the grid has columns and in them we have HTML controls with custom attributes that do not appear in the gridStore.

    So actually, you just want one row to be refreshed?

  7. #7
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default

    no, I need the whole grid refreshed which is why I'm calling it. 7 columns * x Number of Rows, so its easier to refresh the entire grid.

    Instead of this run around Animal, can you see a difference between the grids and the way I'm calling them or not? I appreciate that you are trying to help, but the deadline is too close to change the way the page works now. So instead of analyzing best practice, can you see something wrong between Grid1 and Grid2?

    Thanks

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Very easy to fix your problem though. Set "Break on all errors", then when it breaks at that error, see who, what, where and why.

  9. #9
    Sencha User
    Join Date
    Mar 2009
    Posts
    23

    Default

    great! I'll give that a shot! Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •