1. #1
    Ext User fbloggs's Avatar
    Join Date
    May 2008
    Location
    Sidney, BC, Canada
    Posts
    8
    Vote Rating
    0
    fbloggs is on a distinguished road

      0  

    Default cm has no properties in Ext 2.0

    Hi,

    I'm trying to use a grid. I have everything working when I use this construct:


    var grid = new Ext.grid.GridPanel({
    title: 'Customers',
    colModel : cm
    blah blah
    ...

    grid.render('mygrid');

    but I get a 'cm has no properties' runtime error when I code it like this:

    var grid = new Ext.grid.GridPanel('mygrid', {
    title: 'Customers',
    colModel : cm
    blah blah

    grid.render();


    My ColumnModel object looks like this:

    var cm = new Ext.grid.ColumnModel([
    { id: 'id',
    header: "id",
    dataIndex: 'id',
    width: 50
    },
    {
    header: "First Name",
    dataIndex: 'first_name',
    width: 120
    },
    {
    header: "Last Name",
    dataIndex: 'last_name',
    width: 150
    },
    {
    header: "Client",
    dataIndex: 'client_name',
    width : 200,
    sortable: true
    },
    {
    header: "Email Address",
    dataIndex: 'email_addr',
    width: 200
    }

    ]);

    This is all Ext 2.0 code. Anyone have any brilliant ideas what I'm doing wrong?

    Thanks.

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    8
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default

    Are you extending a class or what are you trying to do that you want the different constructor?

  3. #3
    Sencha - Services Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,965
    Vote Rating
    12
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Smile Migrating from 1.1?

    Not valid for 2.0+ :

    Code:
     var grid = new Ext.grid.GridPanel('mygrid', { 
       renderTo : 'mygrid', //instead
    ......
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  4. #4
    Ext User fbloggs's Avatar
    Join Date
    May 2008
    Location
    Sidney, BC, Canada
    Posts
    8
    Vote Rating
    0
    fbloggs is on a distinguished road

      0  

    Default

    I'm trying to do this so that I can add the resizable feature to my grid. The only example I could find uses the syntax I quoted. So, really, the question I have is how to add the resizable functionality to a grid, all coded in Ext 2.0

  5. #5
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    8
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default

    Sorry don't know what you mean by resizable. There are several tutorials with respect to extending in the Learn section.

  6. #6
    Ext User fbloggs's Avatar
    Join Date
    May 2008
    Location
    Sidney, BC, Canada
    Posts
    8
    Vote Rating
    0
    fbloggs is on a distinguished road

      0  

    Default Regarding resizable, I got this code from somewhere

    // make the grid resizable, do before render for better performance
    /* var rz = new Ext.Resizable('mygrid', {
    wrap:true,
    minHeight:100,
    pinned:true,
    handles: 's'
    });
    rz.on('resize', grid.autoSize, grid); */


    I forget where I got it from, but it looks like it is supposed to give me a handle on my grid so I can resize it.

Thread Participants: 2