PDA

View Full Version : Creating new grid



eyo
18 Dec 2014, 1:19 AM
Hello all,


I have a button and a grid. What I want to do is when I click the button, creating new grid with same fields.


Button;


xtype : 'button' ,
name : 'createChainBtn' ,
text : 'Create Chain' ,



Grid;


{
header : "Type" ,
flex : 1 ,
dataIndex : 'allotmenttype' ,
editor : {
xtype : 'combobox' ,
store : [
['AAA' , 'AAA'] ,
['BBB' , 'BBB']
]
}
} ,
{
xtype : 'datecolumn' ,
header : "Start Date" ,
flex : 1 ,
format : 'd.m.Y' ,
dataIndex : 'startDate' ,
editor : {
xtype : 'datefield' ,
format : 'd.m.Y'
}
} ,
{
xtype : 'datecolumn' ,
header : "End Date" ,
flex : 1 ,
format : 'd.m.Y' ,
dataIndex : 'endDate' ,
editor : {
xtype : 'datefield' ,
format : 'd.m.Y'
}
} ,
{
header : "Compartment" ,
flex : 1 ,
dataIndex : 'compartment' ,
editor : {
xtype : 'textfield'
}
}



Thanks!

lumberjack
19 Dec 2014, 1:41 PM
Define a view that represents your grid, then create a new instance of your view each time you click the button.

Regards,
Brian

https://fiddle.sencha.com/#fiddle/fd2
fd2

eyo
23 Dec 2014, 3:16 AM
Thank you for your reply. That's what I want exactly!

Regards, eyo.