rally - Listeners on rallytextfield -
i grab text value input text field "workitemtextfield" can't keypress event fire below code.
ext.define('customapp', { extend: 'rally.app.app', componentcls: 'app', _onworkitemkeypress: function() { console.log('in _onworkitemkeypress'); console.log(this); }, launch: function() { this.add({ title: 'time entry', width: 800, padding: 10, bodypadding: 10, renderto: ext.getbody(), layout: { type: 'vbox', align: 'bottom' }, items: [ { xtype: 'rallytextfield', itemid: 'workitemtextfield', fieldlabel: 'work item id', labelalign: 'top', listeners: { scope: this, keypress: this._onworkitemkeypress } }] }); } });
i able fire replacing listener this:
listeners: { keypress: { element: 'el', fn: this._onworkitemkeypress } }
but doesn't return expect. "this" textfield, can't call getvalue() on it, , attributes expect passed in (from looking @ api) not expect. first arg event, 2nd not sure, , 3rd html element.
i using apps/2.0rc3/sdk.js. have looked @ code can find online , looks foing correctly, there must missing. doing wrong?
i can value of rallytextfield using specialkey
set wait enter, , calling _onworkitemkeypress(field)
. field.getvalue()
works in case. unless goal not complete value entered user, better not use keypress , wait until user indicated done typing.
ext.define('customapp', { extend: 'rally.app.app', componentcls: 'app', items:{ html:'<a href="https://help.rallydev.com/apps/2.0rc3/doc/">app sdk 2.0rc3 docs</a>'}, launch: function() { var = this; that.add({ title: 'my text', itemid:'mytext', width: 800, padding: 10, bodypadding: 10, layout: { type: 'vbox', align: 'bottom' }, items: [ { xtype: 'rallytextfield', itemid: 'workitemtextfield', fieldlabel: 'work item id', labelalign: 'top', listeners: { specialkey: function(field, e){ // e.home, e.end, e.page_up, e.page_down, // e.tab, e.esc, arrow keys: e.left, e.right, e.up, e.down if (e.getkey() == e.enter) { that._onworkitemkeypress(field); } else{ console.log('?'); } } } }] }); }, _onworkitemkeypress:function(field){ console.log('value:',field.getvalue()); } });
Comments
Post a Comment