* @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
* {tag: "input", type: "checkbox", autocomplete: "off"})
*/
- defaultAutoCreate : { tag: "input", type: 'hidden', autocomplete: "off"},
+ defaultAutoCreate : { tag: "input", type: 'hidden', autocomplete: "new-password"},
actionMode : 'viewEl',
this.wrap = this.el.wrap({cls: 'x-form-daypick-item '});
- var r1 = '<table><tr>'
- var r2 = '<tr class="x-form-daypick-icons>';
+ var r1 = '<table><tr>';
+ var r2 = '<tr class="x-form-daypick-icons">';
for (var i=0; i < 7; i++) {
- r1+= '<td>' + Date.dayNames[i].substring(0,3) + '</td>';
+ r1+= '<td><div>' + Date.dayNames[i].substring(0,3) + '</div></td>';
r2+= '<td><img class="x-menu-item-icon" src="' + Roo.BLANK_IMAGE_URL +'"></td>';
}
var viewEl = this.wrap.createChild( r1 + '</tr>' + r2 + '</tr></table>');
-
+ viewEl.select('img').on('click', this.onClick, this);
this.viewEl = viewEl;
- this.wrap.on('click', this.onClick, this);
+ // this will not work on Chrome!!!
this.el.on('DOMAttrModified', this.setFromHidden, this); //ff
this.el.on('propertychange', this.setFromHidden, this); //ie
* @return {Boolean} True if checked, else false
*/
getValue : function(){
- return '';
+ return this.el.dom.value;
},
// private
- onClick : function(){
+ onClick : function(e){
//this.setChecked(!this.checked);
-
+ Roo.get(e.target).toggleClass('x-menu-item-checked');
+ this.refreshValue();
//if(this.el.dom.checked != this.checked){
// this.setValue(this.el.dom.checked);
// }
},
+
+ // private
+ refreshValue : function()
+ {
+ var val = '';
+ this.viewEl.select('img',true).each(function(e,i,n) {
+ val += e.is(".x-menu-item-checked") ? String(n) : '';
+ });
+ this.setValue(val, true);
+ },
/**
* Sets the checked state of the checkbox.
* @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
*/
setValue : function(v,suppressEvent){
+ if (!this.el.dom) {
+ return;
+ }
+ var old = this.el.dom.value ;
+ this.el.dom.value = v;
+ if (suppressEvent) {
+ return ;
+ }
+
+ // update display..
+ this.viewEl.select('img',true).each(function(e,i,n) {
+
+ var on = e.is(".x-menu-item-checked");
+ var newv = v.indexOf(String(n)) > -1;
+ if (on != newv) {
+ e.toggleClass('x-menu-item-checked');
+ }
+
+ });
+
+
+ this.fireEvent('change', this, v, old);
+
-
},
// handle setting of hidden value by some other method!!?!?