Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define([
- "dojo/_base/kernel",
- "dojo/_base/declare",
- "dojo/data/ItemFileWriteStore",
- "dojox/grid/EnhancedGrid",
- "dojox/grid/enhanced/plugins/IndirectSelection",
- ], function(dojo, declare, itemFileWriteStore, grid) {
- dojo.experimental("widgets.grids.PlansGrid");
- var PlansGrid = declare("widgets.grids.PlansGrid", grid, {
- structure:[
- {
- name:'Versions', field:'_item', width: "auto",
- formatter:function(item){
- if(null==item) return;
- var value = item.version;
- if(item.published[0]==true) {
- value = value + " [P]";
- }
- if(item.submitted[0]==true){
- value = value + " [S]";
- }
- return value;
- }
- }
- ],
- store:null,
- editable: false,
- selectionMode:"single",
- emptyMessage:"<i>No results<i/>",
- constructor:function(){
- this.store = new itemFileWriteStore({data:{items:[]}});
- },
- plugins: {indirectSelection: {headerSelector:false, width:"20px", styles:"text-align: center;"}},
- /**
- * Reset the grid data and selection.
- * If data is null or empty, clear the store. Else, reset the store with the new data.
- */
- reset:function(/*array*/data){
- /**
- * Reset the data
- */
- if(null!=data && data.length>0){
- this.setStore(new itemFileWriteStore({data:{items:data}}));
- }
- else{
- this.setStore(new itemFileWriteStore({data:{items:[]}}));
- _this.showMessage(this.emptyMessage);
- }
- /**
- * Reset the selection
- */
- this.selection.clear();
- }
- });
- return PlansGrid;
- });
Advertisement
Add Comment
Please, Sign In to add comment