X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..6b044c28b5f26fb99c86c237ffad19741c0f7f3d:/docs/source/CheckboxGroup.html diff --git a/docs/source/CheckboxGroup.html b/docs/source/CheckboxGroup.html index 182dcb87..2ab28aca 100644 --- a/docs/source/CheckboxGroup.html +++ b/docs/source/CheckboxGroup.html @@ -1,12 +1,18 @@ - -
- -/** + + + +The source code + + + + +/*! + * Ext JS Library 3.3.1 + * Copyright(c) 2006-2010 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license + */ +/** * @class Ext.form.CheckboxGroup * @extends Ext.form.Field *A grouping container for {@link Ext.form.Checkbox} controls.
@@ -149,7 +155,7 @@ Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, { var cc = Ext.apply({items:[]}, colCfg); cc[this.columns[i] <= 1 ? 'columnWidth' : 'width'] = this.columns[i]; if(this.defaults){ - cc.defaults = Ext.apply(cc.defaults || {}, this.defaults) + cc.defaults = Ext.apply(cc.defaults || {}, this.defaults); } cols.push(cc); }; @@ -238,22 +244,28 @@ Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, { }); this.fireEvent('change', this, arr); }, - - // private - validateValue : function(value){ - if(!this.allowBlank){ + + /** + * Runs CheckboxGroup's validations and returns an array of any errors. The only error by default + * is if allowBlank is set to true and no items are checked. + * @return {Array} Array of all validation errors + */ + getErrors: function() { + var errors = Ext.form.CheckboxGroup.superclass.getErrors.apply(this, arguments); + + if (!this.allowBlank) { var blank = true; + this.eachItem(function(f){ - if(f.checked){ + if (f.checked) { return (blank = false); } }); - if(blank){ - this.markInvalid(this.blankText); - return false; - } + + if (blank) errors.push(this.blankText); } - return true; + + return errors; }, // private @@ -264,15 +276,27 @@ Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, { } var dirty = false; + this.eachItem(function(item){ if(item.isDirty()){ dirty = true; return false; } }); + return dirty; }, + // private + setReadOnly : function(readOnly){ + if(this.rendered){ + this.eachItem(function(item){ + item.setReadOnly(readOnly); + }); + } + this.readOnly = readOnly; + }, + // private onDisable : function(){ this.eachItem(function(item){ @@ -287,14 +311,6 @@ Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, { }); }, - // private - doLayout: function(){ - if(this.rendered){ - this.panel.forceLayout = this.ownerCt.forceLayout; - this.panel.doLayout(); - } - }, - // private onResize : function(w, h){ this.panel.setSize(w, h); @@ -303,11 +319,26 @@ Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, { // inherit docs from Field reset : function(){ - this.eachItem(function(c){ - if(c.reset){ - c.reset(); - } - }); + if (this.originalValue) { + // Clear all items + this.eachItem(function(c){ + if(c.setValue){ + c.setValue(false); + c.originalValue = c.getValue(); + } + }); + // Set items stored in originalValue, ugly - set a flag to reset the originalValue + // during the horrible onSetValue. This will allow trackResetOnLoad to function. + this.resetOriginal = true; + this.setValue(this.originalValue); + delete this.resetOriginal; + } else { + this.eachItem(function(c){ + if(c.reset){ + c.reset(); + } + }); + } // Defer the clearInvalid so if BaseForm's collection is being iterated it will be called AFTER it is complete. // Important because reset is being called on both the group and the individual items. (function() { @@ -346,14 +377,33 @@ myCheckboxGroup.setValue('cb-col-1,cb-col-3'); return this; }, + /** + * @private + * Sets the values of one or more of the items within the CheckboxGroup + * @param {String|Array|Object} id Can take multiple forms. Can be optionally: + *