pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Javascript pastebin - collaborative debugging tool View Help


Posted by James Lorenzen on Wed 4 Nov 04:38 (modification of post by James Lorenzen view diff)
report abuse | download | new post

  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. };

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post