//>>built
define("manager/TransferBox","dojo/_base/declare dijit/_Widget dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dgrid/OnDemandList dgrid/Selection dgrid/Keyboard dojo/dom-construct dojo/text!./templates/TransferBox.html dijit/form/Button".split(" "),function(f,k,l,m,n,p,q,e,r){function g(a,b){var c=0;a.on("dgrid-select",function(a){c+=a.rows.length;b.set("disabled",!c)});a.on("dgrid-deselect",function(a){c-=a.rows.length;b.set("disabled",!c)})}var h=f([n,p,q]);return f("Manager.TransferBox",[k,
l,m],{templateString:r,baseClass:"TransferBox",sortProperty:"id",selectionMode:"extended",postCreate:function(){this.inherited(arguments);this.addButton.set("disabled",!0);this.removeButton.set("disabled",!0);var a=this.from=new h({store:this.store,selectionMode:this.selectionMode,query:function(a){return!a.__selected},sort:this.sortProperty,renderRow:this.renderItem},this.fromNode);g(a,this.addButton);a=this.to=new h({store:this.store,selectionMode:this.selectionMode,query:function(a){return a.__selected},
sort:this.sortProperty,renderRow:this.renderItem},this.toNode);g(a,this.removeButton)},_setValueAttr:function(a){for(var b=!this.from||!this.from._started,c=0;c<a.length;c++){var d=this.store.get(a[c]);d&&(d.__selected=!0,b&&this.store.put(d),this.input(d.id,"add"))}},_getValueAttr:function(){var a=this.store;return a.query(function(a){return a.__selected}).map(function(b){return a.getIdentity(b)})},add:function(){for(var a in this.from.selection){var b=this.from.row(a);b.data.__selected=!0;this.store.put(b.data);
this.input(a,"add")}},remove:function(){for(var a in this.to.selection){var b=this.to.row(a);b.data.__selected=!1;this.store.put(b.data);this.input(a,"del")}},input:function(a,b){var c=this.idHidden+"["+a+"]";"add"==b?e.create("input",{type:"hidden",id:c,name:c,value:a},manager.getParentForm(this.id)):"del"==b&&e.destroy(c)},renderItem:function(a){return e.create("div",{innerHTML:a.name})}})});
//@ sourceMappingURL=TransferBox.js.map