Ext JS - Learning Center

Manual talk:Widgets:Grids:GridView

From Learn About the Ext JavaScript Library

Jump to: navigation, search

Can't execute Ext.grid

Hello, I'am trying to execute the example belove, but can't vew any result:

function myGrid(sender){

   var myData = [

['3m Co',71.72,0.02,0.03,'9/1 12:00am'],

           ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
           ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
           ['American Express Company',52.55,0.01,0.02,'9/1 12:00am']
   ];
   
   var cm = new Ext.grid.ColumnModel([
       {id:'company',header: "Company", width: 160, sortable: true, locked:false, dataIndex: 'company'},
       {header: "Cod", width: 50, dataIndex: 'Cod'},

{header: "Nom", width: 50, dataIndex: 'Nom'}, {header: "Prn", width: 50, dataIndex: 'Prn'}

   ]);
   cm.defaultSortable = true;
   
   var ds = new Ext.data.Store({

proxy: new Ext.data.MemoryProxy(myData), reader: new Ext.data.ArrayReader({}, [

                      {name: 'company'},
                      {name: 'price', type: 'float'},
                      {name: 'change', type: 'float'},
                      {name: 'pctChange', type: 'float'},
                      {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
                 ])
       });
       ds.load();
   var grid = new Ext.grid.Grid('my-grid', {
       ds: ds,
       cm: cm,
       selModel: mySelectionModel,
       autoSizeColumns: true,
       monitorWindowResize: false,
       trackMouseOver: true,
       autoExpandColumn: 'company'
   });
   grid.render();
   grid.getSelectionModel().selectFirstRow();
   ds.reload();

}

and in my JSP page: ... myGrid(this); ... <tr>

   <td width="100%" valign="top" colspan="5">       
   </td>

</tr>

Someone to help-me please !!!

  • This page was last modified 16:21, 17 January 2008.
  • This page has been accessed 518 times.