Posted By

peteinlux on 11/12/08


Tagged

textmate extjs


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Anber


EXTJS - basic grid blueprint


 / Published in: Other
 

  1. /**
  2. * generate a grid, it so commonly used that i decided to make it easy to initiate
  3. */
  4.  
  5. var getNewGrid = function (id, store, columns) {
  6.  
  7. var store = store || new Ext.data.JsonStore({
  8. url: 'get-images.php',
  9. root: 'elements',
  10. fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
  11. });
  12.  
  13. var columns = columns || [
  14. {id: 'name', header: 'Name', sortable: true, dataIndex: 'name'},
  15. {header: 'Modified', width: 120, sortable: true, dataIndex: 'modified'},
  16. {header: 'Type', width: 120, sortable: true, dataIndex: 'type', readOnly: false},
  17. {header: 'Size', width: 120, sortable: true, dataIndex: 'size', align: 'right'}
  18. ]
  19.  
  20. return {
  21. id : id
  22. ,xtype : 'grid'
  23. ,store : store
  24. ,columns : columns
  25. ,autoLoad : false
  26. }
  27. } // eo function
  28.  

Report this snippet  

You need to login to post a comment.