voyent
dynamic panels with ace:list and binding attribute not displaying panels  XML
Forum Index -> Components
Author Message
emaranu

Joined: 03/Oct/2016 06:55:10
Messages: 3
Offline


Hello All,
I am creating dynamic panels with one child inside. The child is a textArea. I see that icefaces has an ace:list that lets change the order of the panels on the UI. I like this feature so I want to render the the dynamic panels using ace:list.

There is an issue though that i can not figure out with rendering with ace:list

Here is how i setup my panels. Very simple
Code:
List<Panel> panelList = new ArrayList<Panel>();
 Panel panel = new Panel();
 panel.setClosable(true);
 panel.setHeader(name);
 
 HtmlInputTextarea uiTextBox = new HtmlInputTextarea();
 uiTextBox.setDisabled(true);
 uiTextBox.setCols(50);
 uiTextBox.setRows(5);
 uiTextBox.setRendered(true);
 uiTextBox.setId("textbox_"+id);
 
 panel.getChildren().add(uiTextBox);
 panelList.add(panel);
 


If i use a forach loop like this. It prints out the panels and it children successfully.
Code:
<ace:panel header="Foreach">
 	<c:forEach items="#{dynamicPanelBean.panelList}" var="panel" >
 		<ace:panel binding="#{panel}"/>
 	</c:forEach>
 </ace:panel>


If i use an ace list to render the panels then an empty panel is rendered and none of children are rendered.
Code:
<ace:panel header="List">
 		<ace:list value="#{dynamicPanelBean.panelList}" var="panel">
 			 <ace:panel binding="#{panel}" ></ace:panel>
 		</ace:list>
 </ace:panel>    



My thoughts

It does not seem that the binding attribute is read when ace list is printing the elements. Maybe the ace:list was not designed to do this.
judy.guglielmin

Joined: 20/Feb/2007 00:00:00
Messages: 1396
Offline


It's more likely the problem is the binding attribute on the panel, but why use binding when it is not considered good design (and unneccessary?).

Your list is the only thing that needs to be dynamic in your backing bean. Since a textEntry takes a string as input, then you just need two List<String>...one for the original list and another for the one your user will create with the <ace:list> component and your originalList:-
{code}
<ace:listControl id="dualList".......">
<f:facet name="header">
Dual Header
</f:facet>
<ace:list id="firstList" value="#{backing.stringFirstList}"/>

<ace:list id="secondList" value="#{backing.stringSecondList}"
var="item"
dropGroup="blockGroup">
<h:panelGrid columns="1" id="hurf">
<ace:textEntry value=#{item} />
<f:facet name="header">
<h:outputText value="If not simple String list can have a title too" /><hr/>
</f:facet>
<ace:textEntry value=#{item} />

</h:panelGrid>
</ace:list>
</ace:list>
</ace:listControl>
{code}
Of course, this is a list full on input components, so not sure that's what you actually meant....you may want a "readonly" attribute on there that you can modify if you actually want input ability, but you get the idea. You can use the f:facet for a header on the block item that you want in the list (no need for an ace:panel, but you could most likely use that as well with a header value in your list object).
lots of ways to do this without component binding. (which has limitations in JSF since it needs to be in Request scope, etc).
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team