PDA

View Full Version : Edit dynamic generated fields



pratik016
15 Oct 2010, 12:00 AM
Hi,

Can anyone tell me how to edit dynamic generated field.

I have a formPanel. I am creating form-fields dynamically. All fields created successfully. Now problem is started that how to edit that form(or we can say need to populate data from database). I have all values in database.

Please help me on this...:)

pratik016
15 Oct 2010, 12:17 AM
I have created all fields using .add{items} method. not using clone.

pratik016
15 Oct 2010, 2:20 AM
Please reply me... it is important for me to solve this...

Animal
15 Oct 2010, 2:28 AM
Nobody knows what you are asking.

test45
15 Oct 2010, 2:38 AM
My poor example (be carreful I use jQuery),
I hope I helped you

Extjs with jQuery....

form.getForm().load({
url:"/url",
waitMsg: "Waiting please",
params: {art_id: art_id},
success: function(form, action){
$('hasCEP', $(form.reader.xmlData.documentElement)).each(function(){ //jquery here
var flag = $('ONE', $(this)).text(); //jquery again
var label = $('TWO', $(this)).text();
var other = $('THREE', $(this)).text();
form.add(new Ext.form.NumberField({
id: "cep_compositefield_" flag,
fieldLabel: label,
name: flag,
value: other
});
});
formEditArticle.doLayout();
});

XML loaded


luck1
luck2
luck3


luck1
luck2
luck3

pratik016
15 Oct 2010, 3:28 AM
My poor example (be carreful I use jQuery),
I hope I helped you

Extjs with jQuery....

form.getForm().load({
url:"/url",
waitMsg: "Waiting please",
params: {art_id: art_id},
success: function(form, action){
$('hasCEP', $(form.reader.xmlData.documentElement)).each(function(){ //jquery here
var flag = $('ONE', $(this)).text(); //jquery again
var label = $('TWO', $(this)).text();
var other = $('THREE', $(this)).text();
form.add(new Ext.form.NumberField({
id: "cep_compositefield_"+flag,
fieldLabel: label,
name: flag,
value: other
});
});
formEditArticle.doLayout();
});XML loaded

<hasCEP>
<ONE>luck1</ONE>
<TWO>luck2</TWO>
<THREE>luck3</THREE>
</hasCEP>
<hasCEP>
<ONE>luck1</ONE>
<TWO>luck2</TWO>
<THREE>luck3</THREE>
</hasCEP>

@ test45 (http://www.sencha.com/forum/member.php?187729-test45) : Thanks for your example... It tricked me where to generate data. Hopefully I will get success....
@ Animal (http://www.sencha.com/forum/member.php?10-Animal) :
Dear, Sorry for wrote superficially.
I have a form-panel. I am creating field dynamically (on fly). Default I have none field. but by clicking button, I may have many form-fields. Using .add method : (code snippest is on http://www.sencha.com/forum/showthread.php?112477-Move-component-in-FormPanel&p=524945#post524945 in my post.)
Now I need form in edit mode. But default I have none form-field But I have all fields in database. So need some idea from you genius guys to edit dynamic generated form like this.
Hope you understand this. Any question welcome.

Animal
15 Oct 2010, 3:30 AM
You mean like changing the label text by clicking on it or something like that? Because just "edit mode" has a million meanings.

pratik016
15 Oct 2010, 3:36 AM
Here, edit mode means I have data from database and need to populate in form.
And form does not have any field default. We can create form-field on fly.

Animal
15 Oct 2010, 4:22 AM
Ahhhhhh!

http://dev.sencha.com/deploy/dev/docs/?class=Ext.Component?class=Ext.form.BasicForm&member=load