Advertisement
Guest User

James Lorenzen

a guest
Nov 3rd, 2009
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Ext.ns("Netcds.core");
  2.  
  3. Netcds.core.EventGrid = function(config) {
  4.  
  5.     Ext.apply(this, config);
  6.  
  7.     // sample static data for the store
  8.     var myData = [
  9.         ['title1','9/1 12:00am','9/1 12:00am'],
  10.         ['title2','9/1 12:00am','9/1 12:00am']
  11.     ];
  12.  
  13.     // create the data store
  14. //    var store = new Ext.data.ArrayStore({
  15. //        fields: [
  16. //           {name: 'title'},
  17. //           {name: 'dateCreated', type: 'date', dateFormat: 'n/j h:ia'},
  18. //           {name: 'lastUpdated', type: 'date', dateFormat: 'n/j h:ia'}
  19. //        ]
  20. //    });
  21.  
  22.     var store = new Ext.data.JsonStore({
  23. @@      url: "/netcds/event/list.json",
  24.         root: "list",
  25.         fields: ["id", "title", "dateCreated", "lastUpdated"]
  26.     });
  27.  
  28.     store.load();
  29.  
  30.     // manually load local data
  31. //    store.loadData(myData);
  32.    
  33.     var getBottomToolbar = function(roles, role) {
  34. @@      if (roles.contains(role)) {
  35.             return [
  36.                     "->",
  37.                     {text: "Delete"}
  38.                 ];
  39.         } else {
  40.             return [];
  41.         }
  42.     };
  43.  
  44.     // create the Grid
  45.     var grid = new Ext.grid.GridPanel({
  46.         store: store,
  47.         columns: [
  48.             {header: 'ID', width: 15, sortable: true, dataIndex: 'id'},
  49.             {header: 'Title', width: 100, sortable: true, dataIndex: 'title'},
  50. //            {header: 'Created', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'dateCreated'},
  51.             {header: 'Created', width: 85, sortable: true, dataIndex: 'dateCreated'},
  52.             {header: 'Updated', width: 85, sortable: true, dataIndex: 'lastUpdated'}
  53. //            {header: 'Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastUpdated'}
  54.         ],
  55.         viewConfig: {
  56.                 forceFit: true
  57.         },
  58.         stripeRows: true,
  59.         autoHeight: true,
  60.         width: 550,
  61.         title: 'Event Grid',
  62.         bbar: getBottomToolbar(this.roles, "ROLE_ADMIN")
  63.     });
  64.  
  65.     // render the grid to the specified div in the page
  66.     grid.render('event-grid');
  67. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement