def buildRows: NodeSeq = (empty /: data)((l, r) => l ++ <tr><td>{r}</
td></tr>)

is just an example that shows that you have full programmatic control
for generating rows.

such as:

def buildRows: NodeSeq = (empty /: data)((l, r) => l ++ (if
(condition) <tr><td>{r}</td></tr> else ....))

There are many ways to do it ... this is just an example. You can also
use chooseTemplate ... which you can find examples in the sites/
example application (see CountGame)

Br's,
Marius

On Apr 21, 1:57 pm, pravin <pravinka...@gmail.com> wrote:
> but there is case ,
> suppose, whether a particular row is  present depends on some
> condition, leading to code like this :
>
> <%for(int a=0;a<collection.size();a++){                 //start loop
> %>
>
> <% if(condition)%>                                            // check
> of condition
>       <tr><td>.......</td></tr>
> <% else{ %>
>        <tr><td>.......</td></tr>
>  <%}                                               // if else block
> closed}                                                     // loop closed
>
> %>
>
> we can do this in JSP ,what will be the corresponding code in lift
>
> Sorry for such basic question but i am from JSP background and new to
> lift
>
> Thanks in advance....
>
> On Apr 21, 1:25 pm, "marius d." <marius.dan...@gmail.com> wrote:
>
> > Perhaps something like:
>
> > // in your markup
>
> > <lift:TableFeed.build>
> > <table>
> >   <t:rows/>
> > </table>
> > </lift:TableFeed.build>
>
> > // your snippet
>
> > class TableFeed {
>
> > val data = "Item1" :: "item2" :: Nil
> > val empty: NodeSeq = NodeSeq.Empty
>
> > def buildRows: NodeSeq = (empty /: data)((l, r) => l ++ <tr><td>{r}</
> > td></tr>)
>
> > def build(xhtml: NodeSeq) : NodeSeq = {
>
> >   bind("t", xhtml,
> >     "rows" -> buildRows
> >   )
>
> > }
> > }
>
> > On Apr 21, 9:19 am, pravin <pravinka...@gmail.com> wrote:
>
> > > i have already done with this,
>
> > > But this is static page.no of rows in display table is fixed.
> > >  but suppose i have collection of data with variable  size , and i
> > > want to display that data in table (e.g list of employee with
> > > details).
>
> > > So my concern is how i iterate over collection dynamically in lifts.
> > > (In JSP these is support of JSTL(Tag libraries)  [e.g
> > > <c:test>,<c:forEach>,<c:if>,]
>
> > > How can i do this in lift
>
> > > On Apr 20, 6:14 pm, Dmitry Lipovoi <dmitry.lipo...@gmail.com> wrote:
>
> > > > Is it what you looking for?
>
> > > >http://wiki.liftweb.net/index.php/Lift_View_First
>
> > > > On Mon, Apr 20, 2009 at 4:37 PM, pravin <pravinka...@gmail.com> wrote:
>
> > > > > Hi,
> > > > > I want to create dynamic table into response.
> > > > > I have list of objects just i want to place them into table.
>
> > > > > Also i have to to place these rows conditionally.So i can use if
> > > > > else ,for loop in HTML code
>
> > > > > We can do this easily in JSP.(I am new to lift framework)
>
> > > > >  Thanks in advance...!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to