• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[SOLVED] grid.reconfigure() looses selModel config ???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] grid.reconfigure() looses selModel config ???

    I have a MVC app with a view definition that contains a selModel config. In a controller, I have a function that reconfigures the grid passing both a store and column. The grid does reconfigure properly with the new store definition and column definition but there is no checkbox in the first column of the grid. Either there is a step I'm missing or maybe there is still a bug with the reconfigure method. (I've seen numerous posts but it seems to have been fixed long ago). The selModel just goes poof... Is there something else I need to do to get the selModel back into the grid? It's version ExtJs 4.2.1

    The view definition and controller function code:
    Code:
    Ext.define('ImageInquiry.view.IndexGrid', {
        extend: 'Ext.grid.Panel',
        alias: 'widget.indexgrid',
    
    
        initComponent: function() {
            var me = this;
            Ext.apply(me, {
                store: 'Rvabreps',
                frame: true,
                forceFit: true,
                autoScroll: true,
                stripeRows: true,
                viewConfig: {
                    loadingText: 'Getting Indexes...',
                    deferEmptyText: true,
                    emptyText: '*** No matching indexes found for search criteria ***'
                },
    
    
                selModel: {
                    xtype: 'checkboxmodel',
                    mode: 'MULTI',
                    ignoreRightMouseSelection: true,
                    checkOnly: true,
                    injectCheckbox: 0,
                    showHeaderCheckbox: true
                },
    
    
                tbar: me.buildTbar(),
                bbar: me.buildBbar(),
                columns: me.buildColumns(),
                menu: me.buildMenu()
            });
    
    
            me.callParent(arguments);
        },
    
    
        buildColumns: function() {
            return [{}];
        },
    
    
        buildTbar: function() {
            return [{
                xtype: 'tbtext',
                text: 'Ready to Search'
            }];
        },
        
        buildBbar: function(){
            return [{
                xtype: 'tbtext',
                text: 'Total matching indexes: ',
                itemId: 'grid-count'
            }];
        
        },
    
    
        buildMenu: function() {
            return Ext.create('Ext.menu.Menu',{
                items: [{
                    text: 'Show Notes',
                    icon: '/internet/rvi/images/comment.png',
                    itemId: 'menu-shownotes'
                }, {
                    text: 'Email Image',
                    icon: '/internet/rvi/images/email.png',
                    itemId: 'menu-emailimage'
                }, {
                    text: 'Fax Image',
                    icon: '/internet/rvi/images/email.png',
                    itemId: 'menu-faximage'
                }, {
                    text: 'Index Details',
                    icon: '/internet/rvi/images/zoom.png',
                    itemId: 'menu-indexdetails'
                }]
            });
        }
    });
    
    
    ************controller code function************
    Ext.define('ImageInquiry.controller.buildGrid', {
        extend: 'Ext.app.Controller',
        
        refs: [{
            ref: 'IndexGrid',
            selector: 'indexgrid'
        }],
    
    
        onBuildGrid: function() {
    
    
            var store = this.getStore('Keys');
            var grid = this.getIndexGrid();
            var rvabrep = this.getStore('Rvabreps');
            
            var columnModel = [];
            var fields = [];
            
            for (i = 0; i < store.data.items.length; i++) {
                dataIndex = store.data.items[i].data.IDX;
                text = store.data.items[i].data.IDXDESC;
                
                if(dataIndex === 'SYSTRAN'){
                    hidden = 'true';
                }else{
                    hidden = 'false';
                }
                
                columnModel.push({
                    text: text,
                    dataIndex: dataIndex,
                    hidden: (hidden === 'true') ? true : false
                });
                fields.push({
                    name: dataIndex
                });
            }
             
            rvabrep.model.setFields(fields);
            grid.reconfigure(rvabrep, columnModel);
        }
    });

  • #2
    sometimes you just want to break something!!!! ugh... always such simple answers...

    changed to config to;

    Code:
       selType: 'checkboxmodel',
       selModel: {
           ignoreRightMouseSelection: true,
           checkOnly: true,
           injectCheckbox: 0,
           showHeaderCheckbox: true
    }

    Comment

    Working...
    X