How to add if condition inside ITEMS in ExtJS?

1.2k Views Asked by At

How can I add if condition inside items in ExtJS?

i want to change it like this ->

if x=='save' then items should be nameLabel, descriptionLabel

if x=='edit' then items should be workLabel, descriptionLabel

items : [
                nameLabel, descriptionLabel 
        ]
1

There are 1 best solutions below

0
On BEST ANSWER

You can try declaring the items array as follow :

Items = [ ( x=='save' ? ['nameLabel'] : [workLabel]), 'itemDescription'];