Greetings all,

I need some help with a simple problem that I'm struggling to solve.

I'm writing a simple expense tracking application.  To keep it simple,
I have a months and expenses.  I can have a number of months, and each
month can have more than one expense:

class Month extends LongKeyedMapper[Month] with IdPK {
  ...
  def expensesformonth = Expense.findAll( By(Expense.month,this.id) )
}

I have HTML to print out expenses for a given month (i.e. URL = .../
month/12):

<lift:MonthPage.summary>
...
<thismonth:expenseitem>
<tr>
        <td><month:item /></td>
        <td align="right"><month:amount /></td>
</tr>
</thismonth:expenseitem>
...
</lift:MonthPage.summary>

The area I'm having problems with is the code to drive the above
HTML.  I need something like:

class MonthPage {
  def summary( xhtml : NodeSeq ) : NodeSeq = S.param("month") match {
    case Full(m) => {
      val allexpenses : NodeSeq = expensesformonth.flatmap({ month =>
          bind("month", chooseTemplate("thismonth", "expenseitem",
xhtml),
              "name" -> Text( month.item ),
              "amount" -> Text( month.amount )
          )
        })
      bind("thismonth", xhtml, "expenseitem" -> allexpenses)
    }
    case _ => {
      Text( "Not a valid month." )
    }
  }
}

I've tried using different expressions in place of "expensesformonth"
above, but they either don't compile or don't work.

Please can someone point me in the right direction.  I have been
working through the Lift PDF book, but haven't come across this sort
of thing in there.

Thanks,

Paul.
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to