source: Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.js @ 275

Last change on this file since 275 was 275, checked in by hendrikvanantwerpen, 13 years ago
  • [Server] Added PUT support to API.
  • [Client] Extended questions page with Accordion and list with actions on each row.
File size: 1.2 KB
Line 
1define(['dojo/_base/declare','dojo/_base/lang','dijit/form/Button','dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','dojo/text!rft/ui/LineWithActionsWidget.html'],
2    function(declare,lang,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){
3        return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
4            templateString: templateString,
5            title: '',
6            userObject: null,
7            actions: {},
8            startup: function() {
9                this.inherited(arguments);
10                this._setupActions();
11                this.refresh();
12            },
13            _setupActions: function() {
14                for (var action in this.actions) {
15                    new Button({
16                        label: action,
17                        onClick: lang.hitch(this,function(){
18                            this.actions[action](this.userObject);
19                        })
20                    }).placeAt(this.actionBar);
21                }
22            },
23            refresh: function() {
24                this.titleNode.innerHTML = this.title;
25            }
26        });
27    });
Note: See TracBrowser for help on using the repository browser.