Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.ns("Netcds.core");
- Netcds.core.EventGrid = function(config) {
- Ext.apply(this, config);
- // sample static data for the store
- var myData = [
- ['title1','9/1 12:00am','9/1 12:00am'],
- ['title2','9/1 12:00am','9/1 12:00am']
- ];
- // create the data store
- // var store = new Ext.data.ArrayStore({
- // fields: [
- // {name: 'title'},
- // {name: 'dateCreated', type: 'date', dateFormat: 'n/j h:ia'},
- // {name: 'lastUpdated', type: 'date', dateFormat: 'n/j h:ia'}
- // ]
- // });
- var store = new Ext.data.JsonStore({
- @@ url: "/netcds/event/list.json",
- root: "list",
- fields: ["id", "title", "dateCreated", "lastUpdated"]
- });
- store.load();
- // manually load local data
- // store.loadData(myData);
- var getBottomToolbar = function(roles, role) {
- @@ if (roles.contains(role)) {
- return [
- "->",
- {text: "Delete"}
- ];
- } else {
- return [];
- }
- };
- // create the Grid
- var grid = new Ext.grid.GridPanel({
- store: store,
- columns: [
- {header: 'ID', width: 15, sortable: true, dataIndex: 'id'},
- {header: 'Title', width: 100, sortable: true, dataIndex: 'title'},
- // {header: 'Created', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'dateCreated'},
- {header: 'Created', width: 85, sortable: true, dataIndex: 'dateCreated'},
- {header: 'Updated', width: 85, sortable: true, dataIndex: 'lastUpdated'}
- // {header: 'Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastUpdated'}
- ],
- viewConfig: {
- forceFit: true
- },
- stripeRows: true,
- autoHeight: true,
- width: 550,
- title: 'Event Grid',
- bbar: getBottomToolbar(this.roles, "ROLE_ADMIN")
- });
- // render the grid to the specified div in the page
- grid.render('event-grid');
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement