Bruno17 / MIGX

MIGX for revo 2.2 and above
85 stars 78 forks source link

actions bar is cropped #49

Open Qwarble opened 12 years ago

Qwarble commented 12 years ago

When I set 'grid autoload' actions button panel is rendered smaller than its real width because of small initial width of entire grid (grid content is loaded after button group is rendered)

(grid autoload is true) And for some reason button "trash view" has not text label. In my tests in code below function _('migx.showtrash') returns undefined. May be it's the reason. When I replace code ('migx.show_trash') to 'Trash' in grid config, text label is rendered fine.

MODx.grid.multiTVdbgridchildstutorial = function(config) { config = config || {}; //console.log(config); this.sm = new Ext.grid.CheckboxSelectionModel();

// define grid columns in a separate variable
var cols=[this.sm];
// add empty pathconfig (source) to array to match number of col in renderimage
var pc=[''];
var renderer = null;
for(i = 0; i <  config.columns.length; i++) {
    renderer = config.columns[i]['renderer'];
    if (typeof renderer != 'undefined'){
        config.columns[i]['renderer'] = {fn:eval(renderer),scope:this};
    }
    cols.push(config.columns[i]);
    pc.push(config.pathconfigs[i]);

}
config.pathconfigs = pc; 
config.columns=cols;    
Ext.applyIf(config,{
autoHeight: true,
collapsible: true,
resizable: true,
loadMask: true,
paging: true,
autosave: false,
remoteSort: true,
primaryKey: 'id',
isModified : false,    
sm: this.sm,
viewConfig: {
    emptyText: 'No items found',
    forceFit: true,
    autoFill: true
},
url : config.url,
baseParams: { 
    action: 'mgr/migxdb/getList',
    configs: config.configs,
    resource_id: config.resource_id,
    object_id: config.object_id,
    'HTTP_MODAUTH': config.auth
},
fields: [],    
columns: [], // define grid columns in a separate variable
tbar: [
      {
        xtype: 'buttongroup',
        title: 'Actions',
        columns: 4,
        defaults: {
            scale: 'large'
        },
        items: [{text:'Add Childresource',handler:this.addItem,scope:this},{text:'Bulk Actions',menu:[{text:'Publish Selected',handler:this.publishSelected,scope:this},{text:'Unpublish Selected',handler:this.unpublishSelected,scope:this},{text:'Delete Selected',handler:this.deleteSelected,scope:this}]},{text:_('migx.show_trash'),handler:this.toggleDeleted,scope:this,enableToggle:true}]
      }       
      ]        
});

MODx.grid.multiTVdbgridchildstutorial.superclass.constructor.call(this,config)
this._makeTemplates();
this.getStore().pathconfigs=config.pathconfigs;
this.on('click', this.onClick, this);   

};

Bruno17 commented 12 years ago

this is one of the reasons, I have the option 'by button' , 'auto' doesn't work correctly in all situations. (for example on the resource-editing-page, language isn't loaded at this time)

Qwarble commented 12 years ago

Yes, but if there is option"Auto" it should work correctly. Unfortunately I can't yet fix it myself, I dont understand all the aspects of migx code. If its not an issue but feature I'll close it. I think it can be fixed by adding timout before auto loading grid or attaching different event listener for autoloading. May be you already have tried this.