Changeset 384 for Dev/branches/rest-dojo-ui/client/rft/ui/OrderedList.js
- Timestamp:
- 07/29/12 00:03:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/OrderedList.js
r383 r384 2 2 'dojo/_base/declare', 3 3 'dojo/_base/lang', 4 'dijit/_WidgetBase', 5 'dijit/_TemplatedMixin', 6 'dijit/_WidgetsInTemplateMixin', 7 'dijit/_Container', 4 'dijit/form/Button', 8 5 'rft/ui/List', 9 6 'dojo/text!./templates/OrderedList.html' … … 11 8 declare, 12 9 lang, 13 _WidgetBase, 14 _TemplatedMixin, 15 _WidgetsInTemplateMixin, 16 _Container, 10 Button, 17 11 List, 18 12 templateString 19 13 ){ 20 return declare('rft.ui.OrderedList',[ _WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container,List],{14 return declare('rft.ui.OrderedList',[List],{ 21 15 templateString: templateString, 22 16 baseClass: 'rftLineListView', 23 17 24 18 postCreate: function() { 25 if (this.title) { 26 this.titleNode.innerHTML = this.title; 27 } else { 28 this.domNode.removeChild(this.titleNode); 29 } 19 this.inherited(arguments); 30 20 31 this.source = new dojo.dnd.Source(this.sourceNode, { 32 isSource: true, 33 accept: ["LineListViewItem"], 34 horizontal: false, 35 withHandles: false, 36 copyOnly: false, 37 selfCopy: false, 38 selfAccept: true, 39 delay: 0, 40 singular: true, 41 creator: lang.hitch(this, this.creatorMethod) 42 }); 43 44 new dijit.form.Button({ 21 new Button({ 45 22 label: "Move up", 46 23 showLabel: false, … … 49 26 'class': "trans", 50 27 onClick: lang.hitch(this, function() { 51 this. moveItem("up");28 this._moveSelectedItem("up"); 52 29 }) 53 }, this.btnListMoveUp) ;30 }, this.btnListMoveUp).startup(); 54 31 55 new dijit.form.Button({32 new Button({ 56 33 label: "Move down", 57 34 showLabel: false, … … 60 37 'class': "trans", 61 38 onClick: lang.hitch(this, function() { 62 this. moveItem("down");39 this._moveSelectedItem("down"); 63 40 }) 64 }, this.btnListMoveDown) ;41 }, this.btnListMoveDown).startup(); 65 42 }, 66 43 67 moveItem: function(dir) {44 _moveSelectedItem: function(dir) { 68 45 var node = this.source.getSelectedNodes()[0]; 69 46 if (node) { … … 92 69 var anchor = this.source.getSelectedNodes()[0]; 93 70 if (anchor) { 94 this.source.insertNodes(false, 71 this.source.insertNodes(false,[item], false, anchor); 95 72 } else { 96 this. source.insertNodes(false, [item]);73 this.appendItem(item); 97 74 } 98 }, 99 getItems: function() { 100 return this.source.getAllNodes() 101 .map(function(node){ 102 return this.source.getItem(node.id).data; 103 },this); 104 }, 75 } 76 105 77 }); 106 78 });
Note: See TracChangeset
for help on using the changeset viewer.