Roo.form.DayPicker.superclass.onDestroy.call(this);
}
-});/*
- * RooJS Library 1.1.1
- * Copyright(c) 2008-2011 Alan Knowles
- *
- * License - LGPL
- */
-
-
-/**
- * @class Roo.form.ComboCheck
- * @extends Roo.form.ComboBox
- * A combobox for multiple select items.
- *
- * FIXME - could do with a reset button..
- *
- * @constructor
- * Create a new ComboCheck
- * @param {Object} config Configuration options
- */
-Roo.form.ComboCheck = function(config){
- Roo.form.ComboCheck.superclass.constructor.call(this, config);
- // should verify some data...
- // like
- // hiddenName = required..
- // displayField = required
- // valudField == required
- var req= [ 'hiddenName', 'displayField', 'valueField' ];
- var _t = this;
- Roo.each(req, function(e) {
- if ((typeof(_t[e]) == 'undefined' ) || !_t[e].length) {
- throw "Roo.form.ComboCheck : missing value for: " + e;
- }
- });
-
-
-};
-
-Roo.extend(Roo.form.ComboCheck, Roo.form.ComboBox, {
-
-
- editable : false,
-
- selectedClass: 'x-menu-item-checked',
-
- // private
- onRender : function(ct, position){
- var _t = this;
-
-
-
- if(!this.tpl){
- var cls = 'x-combo-list';
-
-
- this.tpl = new Roo.Template({
- html : '<div class="'+cls+'-item x-menu-check-item">' +
- '<img class="x-menu-item-icon" style="margin: 0px;" src="' + Roo.BLANK_IMAGE_URL + '">' +
- '<span>{' + this.displayField + '}</span>' +
- '</div>'
-
- });
- }
-
-
- Roo.form.ComboCheck.superclass.onRender.call(this, ct, position);
- this.view.singleSelect = false;
- this.view.multiSelect = true;
- this.view.toggleSelect = true;
- this.pageTb.add(new Roo.Toolbar.Fill(), {
-
- text: 'Done',
- handler: function()
- {
- _t.collapse();
- }
- });
- },
-
- onViewOver : function(e, t){
- // do nothing...
- return;
-
- },
-
- onViewClick : function(doFocus,index){
- return;
-
- },
- select: function () {
- //Roo.log("SELECT CALLED");
- },
-
- selectByValue : function(xv, scrollIntoView){
- var ar = this.getValueArray();
- var sels = [];
-
- Roo.each(ar, function(v) {
- if(v === undefined || v === null){
- return;
- }
- var r = this.findRecord(this.valueField, v);
- if(r){
- sels.push(this.store.indexOf(r))
-
- }
- },this);
- this.view.select(sels);
- return false;
- },
-
-
-
- onSelect : function(record, index){
- // Roo.log("onselect Called");
- // this is only called by the clear button now..
- this.view.clearSelections();
- this.setValue('[]');
- if (this.value != this.valueBefore) {
- this.fireEvent('change', this, this.value, this.valueBefore);
- }
- },
- getValueArray : function()
- {
- var ar = [] ;
-
- try {
- //Roo.log(this.value);
- if (typeof(this.value) == 'undefined') {
- return [];
- }
- var ar = Roo.decode(this.value);
- return ar instanceof Array ? ar : []; //?? valid?
-
- } catch(e) {
- Roo.log(e + "\nRoo.form.ComboCheck:getValueArray invalid data:" + this.getValue());
- return [];
- }
-
- },
- expand : function ()
- {
- Roo.form.ComboCheck.superclass.expand.call(this);
- this.valueBefore = this.value;
-
-
- },
-
- collapse : function(){
- Roo.form.ComboCheck.superclass.collapse.call(this);
- var sl = this.view.getSelectedIndexes();
- var st = this.store;
- var nv = [];
- var tv = [];
- var r;
- Roo.each(sl, function(i) {
- r = st.getAt(i);
- nv.push(r.get(this.valueField));
- },this);
- this.setValue(Roo.encode(nv));
- if (this.value != this.valueBefore) {
-
- this.fireEvent('change', this, this.value, this.valueBefore);
- }
-
- },
-
- setValue : function(v){
- // Roo.log(v);
- this.value = v;
-
- var vals = this.getValueArray();
- var tv = [];
- Roo.each(vals, function(k) {
- var r = this.findRecord(this.valueField, k);
- if(r){
- tv.push(r.data[this.displayField]);
- }else if(this.valueNotFoundText !== undefined){
- tv.push( this.valueNotFoundText );
- }
- },this);
- // Roo.log(tv);
-
- Roo.form.ComboBox.superclass.setValue.call(this, tv.join(', '));
- this.hiddenField.value = v;
- this.value = v;
- }
-
});//<script type="text/javasscript">
this.viewEl.select('img',true).each(function(e,i,n){var on=e.is(".x-menu-item-checked");var C=v.indexOf(String(n))>-1;if(on!=C){e.toggleClass('x-menu-item-checked');}});this.fireEvent('change',this,v,B);},setFromHidden:function(){if(!this.el){return;}
this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}
Roo.form.DayPicker.superclass.onDestroy.call(this);}});
-//Roo/form/ComboCheck.js
-Roo.form.ComboCheck=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboCheck : missing value for: "+e;}});};Roo.extend(Roo.form.ComboCheck,Roo.form.ComboBox,{editable:false,selectedClass:'x-menu-item-checked',onRender:function(ct,A){var _t=this;if(!this.tpl){var B='x-combo-list';this.tpl=new Roo.Template({html:'<div class="'+B+'-item x-menu-check-item">'+'<img class="x-menu-item-icon" style="margin: 0px;" src="'+Roo.BLANK_IMAGE_URL+'">'+'<span>{'+this.displayField+'}</span>'+'</div>'});}
-Roo.form.ComboCheck.superclass.onRender.call(this,ct,A);this.view.singleSelect=false;this.view.multiSelect=true;this.view.toggleSelect=true;this.pageTb.add(new Roo.Toolbar.Fill(),{text:'Done',handler:function(){_t.collapse();}});},onViewOver:function(e,t){return;},onViewClick:function(A,B){return;},select:function(){},selectByValue:function(xv,A){var ar=this.getValueArray();var B=[];Roo.each(ar,function(v){if(v===undefined||v===null){return;}var r=this.findRecord(this.valueField,v);if(r){B.push(this.store.indexOf(r))}},this);this.view.select(B);return false;},onSelect:function(A,B){this.view.clearSelections();this.setValue('[]');if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);}},getValueArray:function(){var ar=[];try{if(typeof(this.value)=='undefined'){return [];}var ar=Roo.decode(this.value);return ar instanceof Array?ar:[];}catch(e){Roo.log(e+"\nRoo.form.ComboCheck:getValueArray invalid data:"+this.getValue());return [];}},expand:function(){Roo.form.ComboCheck.superclass.expand.call(this);this.valueBefore=this.value;},collapse:function(){Roo.form.ComboCheck.superclass.collapse.call(this);var sl=this.view.getSelectedIndexes();var st=this.store;var nv=[];var tv=[];var r;Roo.each(sl,function(i){r=st.getAt(i);nv.push(r.get(this.valueField));},this);this.setValue(Roo.encode(nv));if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);}},setValue:function(v){this.value=v;var A=this.getValueArray();var tv=[];Roo.each(A,function(k){var r=this.findRecord(this.valueField,k);if(r){tv.push(r.data[this.displayField]);}else if(this.valueNotFoundText!==undefined){tv.push(this.valueNotFoundText);}},this);Roo.form.ComboBox.superclass.setValue.call(this,tv.join(', '));this.hiddenField.value=v;this.value=v;}});
//Roo/DDView.js
Roo.DDView=function(A,B,C){Roo.DDView.superclass.constructor.apply(this,arguments);this.getEl().setStyle("outline","0px none");this.getEl().unselectable();if(this.dragGroup){this.setDraggable(this.dragGroup.split(","));}if(this.dropGroup){this.setDroppable(this.dropGroup.split(","));}if(this.deletable){this.setDeletable();}
this.isDirtyFlag=false;this.addEvents({"drop":true});};Roo.extend(Roo.DDView,Roo.View,{isFormField:true,reset:Roo.emptyFn,clearInvalid:Roo.form.Field.prototype.clearInvalid,validate:function(){return true;},destroy:function(){this.purgeListeners();this.getEl.removeAllListeners();this.getEl().remove();if(this.dragZone){if(this.dragZone.destroy){this.dragZone.destroy();}}if(this.dropZone){if(this.dropZone.destroy){this.dropZone.destroy();}}},getName:function(){return this.name;},setValue:function(v){if(!this.store){throw "DDView.setValue(). DDView must be constructed with a valid Store";}var A={};A[this.store.reader.meta.root]=v?[].concat(v):[];this.store.proxy=new Roo.data.MemoryProxy(A);this.store.load();},getValue:function(){var A='(';this.store.each(function(B){A+=B.id+',';});return A.substr(0,A.length-1)+')';},getIds:function(){var i=0,A=new Array(this.store.getCount());this.store.each(function(B){A[i++]=B.id;});return A;},isDirty:function(){return this.isDirtyFlag;},getTargetFromEvent:function(e){var A=e.getTarget();while((A!==null)&&(A.parentNode!=this.el.dom)){A=A.parentNode;}if(!A){A=this.el.dom.lastChild||this.el.dom;}return A;},getDragData:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.handleSelection(e);var B=this.getSelectedNodes();var C={source:this,copy:this.copy||(this.allowCopy&&e.ctrlKey),nodes:B,records:[]};var D=this.getSelectedIndexes();for(var i=0;i<D.length;i++){C.records.push(this.store.getAt(D[i]));}if(B.length==1){C.ddel=A.cloneNode(true);}else {var E=document.createElement('div');E.className='multi-proxy';for(var i=0,F=B.length;i<F;i++){E.appendChild(B[i].cloneNode(true));}