-
1. Re: dynamic dataTable
mrohad Aug 2, 2007 3:44 AM (in response to mrohad)if I wasn't clear this is what I want:
_________________________
|____col-1____|____col-2____|
|___fdfdsfdsf__|___dsfdsf____| << data from DB
|___dsfdsf____|___dsfdsf____| << data from DB
|_ _ _ _ __ _ _ | _ _ _ _ _ _ _| << New Row1 using input boxes Added
|_ _ _ _ __ _ _ | _ _ _ _ _ _ _| << New Row2 Added
[save button] -
2. Re: dynamic dataTable
pmuir Aug 2, 2007 6:08 AM (in response to mrohad)Add an empty object (of the correct type) to the backing list.
-
3. Re: dynamic dataTable
mrohad Aug 2, 2007 7:23 AM (in response to mrohad)
what about UI ,
shouldI add the new line with javascript or there is control that already do that? -
4. Re: dynamic dataTable
pmuir Aug 2, 2007 9:02 AM (in response to mrohad)No, do using a s:button or a h:commandButton.
-
5. Re: dynamic dataTable
mrohad Aug 2, 2007 1:06 PM (in response to mrohad)so let see if I understood..
the s:button add new Elemnt to the List
and go back to the page?
now I've the check if the element is empty then I put inputbox instead of lables?
and of course I better do so with ajax , right? -
6. Re: dynamic dataTable
damianharvey Aug 2, 2007 1:17 PM (in response to mrohad)Use ajax. Much nicer ;)
<rich:dataTable id="myTableId" value="#{myBean.myList}" var="row"> ...etc
<a4j:commandLink action="#{myBean.addNewListEntry}" reRender="myTableId">Add New Row</a4j:commandLink>
public void addNewListEntry() { this.myList.add(new WhateverObject()); }
-
7. Re: dynamic dataTable
mrohad Aug 2, 2007 1:19 PM (in response to mrohad)thanks!
i've one more open questions
my exisitng data is not editable andthe new rowis editable
how do you suggest I'll make the new row made out of input boxes
and the rest of the rowsout of just labels? -
8. Re: dynamic dataTable
damianharvey Aug 2, 2007 7:26 PM (in response to mrohad)There are 2 ways that I can think of right now (a bit late for me so sorry if missed some):
1. Build up a list of Beans where the bean has a property that determines whether a value is present or not.
2. Use the EL to figure out if the row is new.
#2 would be my choice. You could so something like:<rich:column> <s:span rendered="#{row.something !=null}"> #{row.whatever} </s:span> <s:span rendered="#{row.something ==null}"> <h:inputText value="#{row.whatever}"/> </s:span> </rich:column>
Cheers,
Damian