- Timestamp:
- 07/03/12 16:57:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.js
r316 r350 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/on','dojo/dom', 'dijit/form/Button',1 define(['dojo/_base/declare','dojo/_base/lang','dojo/on','dojo/dom', 'dojo/dom-class', 'dijit/form/Button', 2 2 'dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin', 3 'dojo/text!./templates/LineWithActionsWidget.html'], 4 function(declare,lang,on,dom,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){ 3 'dojo/text!./templates/LineWithActionsWidget.html' 4 ], 5 function(declare,lang,on,dom,domClass,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){ 5 6 return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{ 6 7 templateString: templateString, 7 8 baseClass: 'rftLineWithButtons', 8 9 title: '', 10 modifiers: "blue", 9 11 userObject: null, 10 12 actions: {}, … … 16 18 this.inherited(arguments); 17 19 this._setupActions(); 20 domClass.add(this.domNode, this.modifiers); 18 21 this.refresh(); 19 22 }, 20 23 _setupActions: function() { 21 24 for (var action in this.actions) { 22 new Button({ 23 label: action, 24 //iconClass: 'dijitIconSearch', 25 //showLabel: false, 26 onClick: lang.hitch(this,function(){ 27 this.actions[action](this.userObject); 28 }) 29 }).placeAt(this.buttonsNode); 25 var properties; 26 if (this.actions[action].properties.blockButton == true) { // BlockButton 27 properties = lang.mixin({ 28 baseClass: 'rftBlockButton', 29 modifiers: this.modifiers, 30 label: "Default", 31 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 32 title: action, 33 onClick: lang.hitch(this, this.actions[action].callback) 34 }, this.actions[action].properties); 35 properties["class"] = properties.modifiers; 36 new Button(properties).placeAt(this.buttonsNode); 37 } else { //InlineButton 38 properties = lang.mixin({ 39 baseClass: 'rftInlineButton', 40 modifiers: 'black', 41 label: "Default", 42 showLabel: false, 43 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 44 title: action, 45 onClick: lang.hitch(this, this.actions[action].callback) 46 }, this.actions[action].properties); 47 properties["class"] = properties.modifiers; 48 new Button(properties).placeAt(this.buttonsNode); 49 } 30 50 } 31 51 }, … … 40 60 return !preventDefault; 41 61 }, 42 onClick: function(e) {} 62 onClick: function(e) {}, 63 _setTitleAttr: function(value){ 64 this.title = value; 65 this.refresh(); 66 } 43 67 }); 44 68 });
Note: See TracChangeset
for help on using the changeset viewer.