1. #1
    Ext JS Premium Member
    Join Date
    Jan 2011
    Location
    NORWAY
    Posts
    109
    Vote Rating
    1
    frankbolviken is on a distinguished road

      0  

    Question Grid with different layouts

    Grid with different layouts


    Hi,

    I have a grid with som data, and based on which value is picked in a combox, I want the grid to be presented in the required "style". For example a defaultview, a detailview and a thumbnailview. If detailview is picked, some more values is presented in the grid on each item.

    Is this possible without to much of a hack?

    Thank you in advance,

    Frank B

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,085
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    We present different filtered 'quick views' from a menu by creating multiple ColumnModels and then calling BaseParams and grid.reconfigure to change. Works great.

    You can create your columns in arrays and then concat the arrays as needed so you are not duplicating column definitions in each CM.

    Regards,
    Scott.

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2011
    Location
    NORWAY
    Posts
    109
    Vote Rating
    1
    frankbolviken is on a distinguished road

      0  

    Default


    Thanks for your reply!!

    Do you have any code-examples on this?
    Would be much appreciated.

    Frank B

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,085
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Here are some quick snippets:
    Please note that this is for ExtJS3, you may have to make changes for ExtJS4

    Menu Item

    Code:
    	text: 'All Payroll Periods',
    	scope: this,
    	group: 'quickview',
    	checked: true,
    	handler: function() {
    		var grid = this.get_grid_panel();
    		// filter cleared
    		grid.store.baseParams = {};
    		grid.reconfigure(grid.store, cmPayroll);
    
    		// set new base params here if needed
    
    		grid.store.load(
    		{
    			params: { .. }
    		}
    		);
    	}
    Column arrays:

    Code:
    var colPeriodBothDays = [
    	{
    		header: 'Position',
    		dataIndex: 'position_name',
    		filter: true,
    		width:  100
    	},
    	
    	...
    
    ];
    
    var colPayrollSuffix = [
    	{
    		header: 'ON',
    		dataIndex: 'total_days_on',
    		filter: true,
    		width:  35
    	},
    	
    	...
    
    ];
    CM:

    Code:
    function build_columns(days,suffix){
        return colPayrollPrefix.concat(days,suffix);
    }
    
    
    var cmPayroll = new Ext.grid.ColumnModel({
        columns: build_columns(colPeriodBothDays,colPayrollSuffix),
        defaults: {
            filter: false,
            menuDisabled: true
        }
    });
    Regards,
    Scott.

  5. #5
    Ext JS Premium Member
    Join Date
    Jan 2011
    Location
    NORWAY
    Posts
    109
    Vote Rating
    1
    frankbolviken is on a distinguished road

      0  

    Default


    Hi again,

    Thank you for replying! Seems like a good example and exactly what I'm looking for, but I'm struggling to rewrite it for extjs4. Since Ext.grid.ColumnModel doesnt exist anymore as far as I can see? Have you had any luck implementing this in an extjs4 app?

    Frank B

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,085
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Frank,

    I have not had the chance to explore this with V4 at this time. Hopefully by the next BETA. In reading some of the posts in this forum, there were 6 related to CM and they mention changes as

    Column->Header
    CM->HeaderContainer

    If you load the Advanced Search and search only V4 forums for columnmodel, you will see these 6 posts.

    Regards,
    Scott.

Similar Threads

  1. Help with Layouts, Part 2 - how "height in ems" fits into layouts in extjs?
    By Eric.Sencha in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 17 Sep 2010, 9:38 AM
  2. Right use of Layouts?
    By zharack in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 17 Mar 2009, 4:31 AM
  3. Help with layouts
    By bjwaski in forum Ext GWT: Help & Discussion (1.x)
    Replies: 8
    Last Post: 6 Jun 2008, 7:55 AM
  4. Auto Resize Grid on Complex Layouts
    By Recode in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 21 Mar 2007, 1:32 PM

Thread Participants: 1

Tags for this Thread