PDA

View Full Version : the code only works with ext-debug.js in extjs4.1.0gpl



wangld
4 Jul 2012, 4:06 AM
Ext.define('Ext.override.form.Labelable', {
override: 'Ext.form.Labelable'

initLabelable: function() {
if (this.allowBlank === false) {
this.beforeLabelTextTpl = '<span style="color:red">*</sapn>';
}

this.callParent(arguments);
}
});

redraid
4 Jul 2012, 5:36 AM
You can't override mixins, use this code:


Ext.form.BaseField.override({
beforeLabelTextTpl: '<span style="color:red">*</sapn>'
});

redraid
4 Jul 2012, 5:42 AM
To mark required fields extend form (or override):

Ext.define('Ext.ux.form', {
extend: 'Ext.form.Panel',
initComponent: function() {
this.on('beforeadd', function(me, field){
if (!field.allowBlank)
field.beforeLabelTextTpl = '<span style="color:red">*</span>';
});
this.callParent(arguments);
}
});

wangld
4 Jul 2012, 5:43 AM
I just want to know why the code only work with the ext-debug.js.
Why it does not work with the ext-all-debug.js

redraid
4 Jul 2012, 5:54 AM
ok. show debugger logs.