View Full Version : How to get value from TextField in FlexTable
I have a FlexTable and Two buttons(Add, Save). When i click on Add button a row containing a widget TextField is added into FlexTable. When i click on the Save button i want to retrieve the value which is typed in TextField. Kindly help me solving this problem.
18 May 2009, 7:41 AM
Keep a reference to the text field and call field.getValue()
But i want to add TextField whenever i click the Add button. How to keep reference of so many TextFields??
18 May 2009, 8:21 AM
27 May 2009, 11:09 PM
Hi Suma, I had the same need as you, and I've solved it in two different manners:
1) you can assign a sort of "numerable" id:
id: 'textfield'+i,where "i" is an index growing with the number of iterations.
In this way you'll have textfield1, textfield2...and you can use getComponent() specifing the id.
2)the problem of the 1)solution is that if you want also to delete dynamically your field, you will get "undefined" results (eg if you have deleted textfield2, the getComponent("textfield2") will return you undefined, stopping your function). So you can get your fields by index: you get the main container,I think your is FlexTable, and then you search for its childs:
ft = Ext.getCmp("flextable-id");
my_field_value = ft.getComponent(0).getValue();
They're just suggestion, maybe you have to change them to fit your application. Hope it helps!
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.