extjs - Define new xtype fields sencha touch MVC -
i have create new xtype in sencha application don't know have put code. tried create new file , add in views array in app.js doesn't work because new xtype field not view
ext.define('dynamo.field.patterntext', { extend : 'ext.field.text', xtype : 'patterntextfield', config : { pattern : '[0-9]*' }, updatepattern : function(pattern) { var component = this.getcomponent(); component.updatefieldattribute('pattern', pattern); }, initialize : function() { this.callparent(); var component = this.getcomponent(); component.input.on({ scope : this, keydown : 'onkeydown' }); }, onkeydown : function(e) { var code = e.browserevent.keycode; if (!(code >= 48 && code <= 57) && !(code >= 97 && code <= 105) && code !== 46 && code !== 8 && code !== 188 && code != 190) { e.stopevent(); } }
});
usually, custom made components declared under ext.ux namespace.
you can put file anywhere want long configure ext.loader correctly:
ext.loader.setconfig({ enabled : true, paths: { 'ext.ux' : 'js/ux' } });
using config put of custom components in js/ux
folder auto loading. particular file path js/ux/field/patterntext.js
also need use correct namespace extending field:
ext.define('ext.ux.field.patterntext', { extend : 'ext.form.field.text',
Comments
Post a Comment