[SOLVED] Adding controls dinamically.

UI Components for JSF
Post Reply
igrachev
Posts: 5
Joined: 10 Apr 2013, 11:05
Contact:

11 Apr 2013, 11:57

Hello,
As you will see in my post below I am new to Prime Faces, but so far I love it :).

What I need atm. is to dinamically add some h:outputText-s and p:selectOneMenu-s to my h:panelGrid, when a value is chosen from a p:selectOneMenu. So far I declared the listener in the axaj to address a method im my bean where I shall handle the code. And here comes the hard part - I don't know how to add my newly created instances of SelectOneMenu to my PanelGrid, or to add my SelectItem to my SelectOneMenu. The same problem I will have with adding attributes to the controls etc. I understand that my question is probably something that cant be answered in one forum post..., I don't expect you to give me the answer, but a place where I can read it myself. I spend quite some time on browsing this forum and stackoverflow and google, but couldn't find my answers :(... A snapshot of a part of code where you do such think will also be really useful.

Here is what i got so far:

Code: Select all

SelectOneMenu myMenu = new SelectOneMenu();
SelectItem myItem = new SelectItem();

PanelGrid myGrid = (PanelGrid)FacesContext.getCurrentInstance().getViewRoot().
       findComponent(":ruleForm:ruleAccordion:inputRuleTab:inputRulePanel:ruleGrid");
But I didn't find anything suitable to add myItem to myMenu or myMenu to myGrid :(.

Thanks for the help guys!.
Have a nice day.
Last edited by igrachev on 12 Apr 2013, 14:23, edited 1 time in total.
IDE = NetBeans
PrimeFaces version = 3.5
Glass Fish AS version = 3.1.2
JSF version = 2.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

11 Apr 2013, 13:34

Generic jsf issue... Look at some of the links here

http://www.google.com/search?q=jsf%20cr ... amatically

igrachev
Posts: 5
Joined: 10 Apr 2013, 11:05
Contact:

12 Apr 2013, 14:23

Thanks,
With the help of this information I found how I am supposed to add the contrls dinamically.
Now new questions arised, but I will try to solve them alone and if I still need third opinion will ask in new topic.

Closing this topic now!.
The information is really useful if some newcomers have the same problem take the time and read it :).

Thanks for the help,
have a nice day.
IDE = NetBeans
PrimeFaces version = 3.5
Glass Fish AS version = 3.1.2
JSF version = 2.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests