* @param {Roo.bootstrap.RadioSet} this This radio
* @param {Roo.bootstrap.Radio} item The checked item
*/
- check : true
+ check : true,
+ /**
+ * @event click
+ * Fires when the element is click.
+ * @param {Roo.bootstrap.RadioSet} this This radio set
+ * @param {Roo.bootstrap.Radio} item The checked item
+ * @param {Roo.EventObject} e The event object
+ */
+ click : true
});
};
}
]
};
-
- if(this.indicatorpos == 'left'){
- label.cn.unshift({
- tag : 'i',
- cls : 'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',
- tooltip : 'This field is required'
- });
- } else {
- label.cn.push({
- tag : 'i',
- cls : 'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',
- tooltip : 'This field is required'
- });
+ if (Roo.bootstrap.version == 3) {
+
+
+ if(this.indicatorpos == 'left'){
+ label.cn.unshift({
+ tag : 'i',
+ cls : 'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',
+ tooltip : 'This field is required'
+ });
+ } else {
+ label.cn.push({
+ tag : 'i',
+ cls : 'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',
+ tooltip : 'This field is required'
+ });
+ }
}
-
var items = {
tag : 'div',
cls : 'roo-radio-set-items'
this.itemsEl = this.el.select('.roo-radio-set-items', true).first();
this.itemsEl.setVisibilityMode(Roo.Element.DISPLAY);
- this.indicatorEl().addClass('invisible');
+ this.indicator = this.indicatorEl();
+
+ if(this.indicator){
+ this.indicator.addClass('invisible');
+ }
this.originalValue = this.getValue();
validate : function()
{
+ if(this.getVisibilityEl().hasClass('hidden')){
+ return true;
+ }
+
var valid = false;
Roo.each(this.radioes, function(i){
markValid : function()
{
- if(this.labelEl.isVisible(true)){
+ if(this.labelEl.isVisible(true) && this.indicatorEl()){
this.indicatorEl().removeClass('visible');
this.indicatorEl().addClass('invisible');
}
- this.el.removeClass([this.invalidClass, this.validClass]);
- this.el.addClass(this.validClass);
+ if (Roo.bootstrap.version == 3) {
+ this.el.removeClass([this.invalidClass, this.validClass]);
+ this.el.addClass(this.validClass);
+ } else {
+ this.el.removeClass(['is-invalid','is-valid']);
+ this.el.addClass(['is-valid']);
+ }
this.fireEvent('valid', this);
},
return;
}
- if(this.labelEl.isVisible(true)){
+ if(this.labelEl.isVisible(true) && this.indicatorEl()){
this.indicatorEl().removeClass('invisible');
this.indicatorEl().addClass('visible');
}
-
- this.el.removeClass([this.invalidClass, this.validClass]);
- this.el.addClass(this.invalidClass);
+ if (Roo.bootstrap.version == 3) {
+ this.el.removeClass([this.invalidClass, this.validClass]);
+ this.el.addClass(this.invalidClass);
+ } else {
+ this.el.removeClass(['is-invalid','is-valid']);
+ this.el.addClass(['is-invalid']);
+ }
this.fireEvent('invalid', this, msg);
setValue : function(v, suppressEvent)
{
+ if(this.value === v){
+ return;
+ }
+
this.value = v;
if(this.rendered){
}
Roo.each(this.radioes, function(i){
-
i.checked = false;
i.el.removeClass('checked');
+ });
+
+ Roo.each(this.radioes, function(i){
if(i.value === v || i.value.toString() === v.toString()){
i.checked = true;
if(suppressEvent !== true){
this.fireEvent('check', this, i);
}
+
+ return false;
}
}, this);