1. #1
    Sencha User
    Join Date
    May 2009
    Location
    Douvrin, France
    Posts
    41
    Vote Rating
    0
    Erwan62 is on a distinguished road

      0  

    Default Empty rows inside a grid

    Empty rows inside a grid


    Hi everybody,

    I read on the forum that we can insert empty rows in a grid that uses a GroupingView to avoid the empty groups to disappear when there are no items inside.

    I found a sample of code that is supposed to insert this empty line in my grid :

    Code:
    // Création de la grille
                
       var grid = new Ext.grid.GridPanel({
        id : 'grid_gp',
        store : ds,                            
        cm : colModel,                          
        sm : sm,                               
        view : new Ext.grid.GroupingView({      
                 showGroupName : false,
                 forceFit : true,
                 groupTextTpl : '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "membres" : "membre"]})'
                 }),
                 listeners: {
                                render: {
                                            fn: function(grid){
                                                 var groups = grid.view.getGroups();
                                                 var ds =  grid.getStore();
                                                 var lastId = ds.data.keys[ds.data.keys.length-1];
                                                                                                
                                                  for (var i = 0; i < groups.length; i++)
                                                  {
                                                     var lastRowOfGroup = grid.view.findLastRowOfGroup(Ext.get(groups[i])) ;
                                                     var r = ds.getAt(lastRowOfGroup).copy();
                                                     r.data.fake = true;
                                                     r.id = ++lastId;
                                                     ds.insert(lastRowOfGroup, r);
                                                   }
                                                },
                                                scope: this
                                            }
                                },
                                enableDrag: true,
                                autoHeight : true,
                                width : 1404,
                                frame : true,
                                stripeRows: true,                      
                                tbar : [                                
                                          {
                                             text : 'Ajouter',
                                             tooltip : 'Ajouter un groupe',
                                             iconCls : 'add',
                                             handler : fct_add
                                           },
                                           '-',
                                           {
                                             text : 'Modifier',
                                             tooltip : 'Modifier un groupe',
                                             iconCls : 'update'
                                           },
                                           '-',                                                            
                                           {
                                             text : 'Supprimer',
                                             tooltip : 'Supprimer un groupe',    
                                             iconCls : 'remove'
                                           }
                                        ]
                                                      });
                                                      
                    grid.view.getRowClass = function(row, index) 
                                            {
                                                if (row.data.fake) 
                                                    return 'x-grid-group-body-hide';
                                            }
                
                    // Afichage de la grille
                    
                    grid.render(document.getElementById('grille_groupes'));
                    
                    ds.load();          // Chargement du datastore
    But it doesn't work, the groups still disappear when I delete all the items...

    Anobody who knows why ?

  2. #2
    Sencha User
    Join Date
    May 2009
    Location
    Douvrin, France
    Posts
    41
    Vote Rating
    0
    Erwan62 is on a distinguished road

      0  

    Default


    Some help please

  3. #3
    Sencha User
    Join Date
    May 2009
    Location
    Douvrin, France
    Posts
    41
    Vote Rating
    0
    Erwan62 is on a distinguished road

      0  

    Default


    It's hard to get some help on this forum...

  4. #4
    Sencha User
    Join Date
    May 2009
    Location
    Douvrin, France
    Posts
    41
    Vote Rating
    0
    Erwan62 is on a distinguished road

      0  

    Default


    Up, please...

  5. #5
    Sencha User
    Join Date
    Mar 2008
    Posts
    566
    Vote Rating
    0
    moegal is on a distinguished road

      0  

    Default


    Erwan62,

    Sorry I cannot help. The forum has been really helpful for me. I am sure someone will lend a hand soon.

    Marty

  6. #6
    Sencha User
    Join Date
    May 2009
    Location
    Douvrin, France
    Posts
    41
    Vote Rating
    0
    Erwan62 is on a distinguished road

      0  

    Default


    I hope :S

Thread Participants: 1