lundi 22 septembre 2014

Open multiple fieldsets based on combo box value

I am using Ext JS4 with Java. I am following the MVC approach. I have a form to get book details. First, I have a fieldset with a combobox to input the 'number of books required' with input values 1,2,3.


Code:



{
xtype : 'fieldset',
title: 'Books',
items:[
{
name : 'Number of Books Required',
xtype : 'combo',
store : new Ext.data.SimpleStore({
fields : [ 'book_count', 'book_val' ],
data : [ [ '1', '1' ],
[ '2', '2' ],
[ '3', '3' ] ]
}),
displayField : 'envName',
valueField : 'envCode'
}
]
}

The second fieldset will contain fields like 'book name' and 'book author'.

Code:



{
xtype : 'fieldset',
title: 'Book 1',
items:[
{
name : 'Book Name',
xtype : 'textfield',
},{
name : 'Book Author',
xtype : 'textfield'
}
]
}

Based on the value selected in the combo box, i need to open 1,2 or 3 fieldsets to accept the book details. Also, i need to update the title of the second fieldset like Book 1,Book 2 or Book 3.

Is it possible to do it from the front end Ext JS? If so,how should I do this?


Considering the best coding practices.. Since I am following MVC, should I put the second fieldset in a different form and load it as needed?

Any reference or information will help..


Thanks in advance






Open multiple fieldsets based on combo box value

Aucun commentaire:

Enregistrer un commentaire