Reading a form-field in sencha touch extjs -
I have a form field and I want to read the text recorded in it, I tried the following code: < / P>
this.searchButton = new Ext.Button ({// button press search will apply the verb text: 'go', handler: this.searchButtonTap, scope: this}); This.topToolbar = new Ext.form.FormPanel ({item: [{xtype: 'textfield', name: 'search', placeholder: 'search'}, this.searchButton]}); SearchButtonTap: function () {// console.log (this.topToolbar.items.items [1]); Var current text = AsApp.views.AsListView.getRecord (); Console.log (currentText); },
You can try:
< Code> This.searchField = new Ext.form.Text ({displayField: 'name', valueField: 'name', editable: true, forceSelection: true, trigger action: 'all', empty text: 'Search ... ', Select onfox: true}); This.searchButton = new Ext.Button ({// button will apply the search action text: 'go', handler: this.searchButtonTap, scope: this}); This.topToolbar = New Ext.Toolbar ({item: [{xtype: 'spacer'}, this.searchField, this.searchButton, {xtype: 'spacer'},}}); SearchButtonTap: function () {var searchText = this.searchField.getValue (); Console.log (searchText); },
Comments
Post a Comment