Extjs with Rails- Problem in adding button dynamically on Panel
I am using ExtJS 3.2.1 with Rails 3.x. I have a Panel on which I want to add ExtJS Buttons "dynamically" depending upon the number of reco开发者_JAVA百科rds in the db. I tried googling but no luck.
Any Suggestions?
Thanks in advance !
It not clear in your question where you are adding the button. Are you adding it into a toolbar or into buttons section of a panel. Either way, you should be able to use the addButton
method available for Toolbar
and Panel
.
panel.addButton({your button config});
Now, to create buttons you will have to wrap it in a loop. Before that you will have to get the necessary data from DB. For getting data, you can use the Ext.Ajax
class and according to the response, iterate and create the buttons.
精彩评论