Hybrid View

  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    30
    Vote Rating
    0
    Greeens is on a distinguished road

      0  

    Default Column width problem when multiple grid on same page

    Column width problem when multiple grid on same page


    When I'm trying to use multiple grid on the same page, I can't seem to have different width length for specific columns on different table.

    var XmlTest1 = {
    init : function(){
    var schema = {
    tagName: 'detail',
    id: 'col1',
    fields: ['col1','col2','col3','col4']
    };
    dataModel = new YAHOO.ext.grid.XMLDataModel(schema);

    var colModel = new YAHOO.ext.grid.DefaultColumnModel([
    {header: "col1", width: 80, sortable: true},
    {header: "col2", width: 80, sortable: true},
    {header: "col3", width: 80, sortable: true},
    {header: "col4", width: 80, sortable: true}
    ]);

    // create the Grid
    var grid = new YAHOO.ext.grid.Grid('test1', dataModel, colModel);
    grid.autoWidth = true;
    grid.autoHeight = true;
    grid.render();

    dataModel.load('test1.xml');
    }
    }
    YAHOO.ext.EventManager.onDocumentReady(XmlTest1.init, XmlTest1, true);

    var XmlTest2 = {
    init : function(){
    var schema = {
    tagName: 'detail',
    id: 'cola',
    fields: ['cola','colb','colc','cold']
    };
    dataModel = new YAHOO.ext.grid.XMLDataModel(schema);

    var colModel = new YAHOO.ext.grid.DefaultColumnModel([
    {header: "cola", width: 20, sortable: true},
    {header: "colb", width: 40, sortable: true},
    {header: "colc", width: 60, sortable: true},
    {header: "cold", width: 80, sortable: true}
    ]);

    // create the Grid
    var grid = new YAHOO.ext.grid.Grid('test2', dataModel, colModel);
    grid.autoWidth = true;
    grid.autoHeight = true;
    grid.render();

    dataModel.load('test1.xml');
    }
    }
    YAHOO.ext.EventManager.onDocumentReady(XmlTest2.init, XmlTest2, true);

    When I insert this two grid (test1 and test2) on the same page, seems like the column heading width is what is define, but the grid content width is always following the second one. When I try to adjust the column width of one grid, it's trying to adjust the column widh of every grid on the page, which is not what I want to do.

    Woud anyone know how to fix this please let me know.
    A thousand thanks!!!

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

Similar Threads

  1. Please Help...Multiple grid on the same page
    By khanh3m in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 1 Aug 2012, 7:56 PM
  2. Grid - Auto-resize column-width after load
    By KimH in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 2 Mar 2007, 4:49 AM
  3. Problem with column width with multiple grids on a page
    By SLerman in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 28 Feb 2007, 8:22 AM
  4. Multiple Grids on a Page, Column Adjust Problem?
    By rooster in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 8 Jan 2007, 1:42 PM
  5. multiple grids -- Column width cross-talk
    By christocracy in forum Ext 1.x: Help & Discussion
    Replies: 10
    Last Post: 16 Dec 2006, 6:40 AM

Thread Participants: 1