ArrayReader and Store : ArrayReader « Ext JS « JavaScript DHTML






ArrayReader and Store

  

<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>

</head>
<script type="text/javascript">

Ext.onReady(function() {
      var store = new Ext.data.Store({
      data: [
        [1,"A","D","2009-02-19",1,"asdf",19.95,true],
        [3,"B","E","2002-02-15",1,"asdf",14.95,1],
        [4,"C","F","2009-10-01",2,"asdf",19.95,true]
        ],
      reader: new Ext.data.ArrayReader({id:'id'}, [
        'id',
        'title',
        'director',
        {name: 'released', type: 'date', dateFormat: 'Y-m-d'},
        'genre',
        'tagline',
        {name: 'price', type: 'float'},
        {name: 'available', type: 'bool'}
      ])
      });
  
      var grid = new Ext.grid.GridPanel({
      renderTo: document.body,
      frame:true,
      title: 'Movie Database',
          height:200,
          width:520,
      enableColumnMove: false,
          store: store,
          columns: [
        {header: "Title", dataIndex: 'title'},
        {header: "Director", dataIndex: 'director'},
        {header: "Released", dataIndex: 'released', renderer: Ext.util.Format.dateRenderer('m/d/Y')},
        {header: "Genre", dataIndex: 'genre'},
        {header: "Tagline", dataIndex: 'tagline'}
          ]
      });
});



</script>
<body>


</body>
</html>

   
    
  








Related examples in the same category

1.Create Store from array reader and name mapping