Hello, I'm new to Lift (and Scala for that matter) and trying to build my first app. For lookup tables (categories etc.) I'd like to use TableEditor. Following the instructions I register the table in boot and call the snippet from my template.The table title shows correctly, the rest of the page is blank. Looking at the source I see the Table editor default template markup unchanged so I assume I've not registered the table correctly in boot.scala and the snippet is never called.Can anyone point me to an example for using TableEditor? Any help is much appreciated. Thanks--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
trait Lookup[L <: Lookup[L]] extends LongKeyedMapper[L] {
self: L =>
object name extends MappedString[L](this, 100) {
override def validations =
valMinLen(3, "Lookup name must be at least 3 characters") _ ::
valUnique("Lookup name must be unique") _ ::
super.validations
}
}
//ExpenseCategory
class ExpenseCategory extends Lookup[ExpenseCategory] with IdPK {
def getSingleton = ExpenseCategory
def canDelete = true
}
object ExpenseCategory extends ExpenseCategory with LongKeyedMetaMapper[ExpenseCategory]{
override def dbTableName = "expense_categories"
}
TableEditor.registerTable("cats", ExpenseCategory, "Expense Categories")
<div id="main" class="lift:surround?with=default;at=content">
<h2>Lookups</h2>
<div class="lift:TableEditor.edit?table=cats;eager_eval=true">
<span class="lift:embed?what=/tableeditor/default"></span>
</div>
</div>I have same problems.In ItemsListEditor"saveBtn" -> SHtml.submit(?("Save"), onSubmit _, noPrompt)
but in /tableeditor/default</table><table:saveBtn /></lift:children>
It's bug?
On Friday, 26 October 2012 18:16:40 UTC+6, Anke Herrmann wrote:Hello, I'm new to Lift (and Scala for that matter) and trying to build my first app. For lookup tables (categories etc.) I'd like to use TableEditor. Following the instructions I register the table in boot and call the snippet from my template.The table title shows correctly, the rest of the page is blank. Looking at the source I see the Table editor default template markup unchanged so I assume I've not registered the table correctly in boot.scala and the snippet is never called.Can anyone point me to an example for using TableEditor? Any help is much appreciated. Thanks
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
).bind("table", "title" -> title, "insertBtn" -> SHtml.submit(?("Insert"), onInsert _, noPrompt), "items" -> {ns:NodeSeq => items.items.flatMap {i => bind("item", customBind(i)(ns), "fields" -> eachField( i, (f: MappedField[_,T]) => Seq("form" -> f.toForm), fieldFilter ), "removeBtn" -> SHtml.submit(?("Remove"), ()=>onRemove(i), noPrompt), "msg" -> ((i.validate match { case Nil => if(!i.saved_?) Text(?("New")) else if(i.dirty_?) Text(?("Unsaved")) else NodeSeq.Empty case errors => (<ul>{errors.flatMap(e => <li>{e.msg}</li>)}</ul>) })) ) } ++ items.removed.flatMap { i => bind("item", customBind(i)(ns), "fields" -> eachField( i, {f: MappedField[_,T] => Seq("form" -> <strike>{f.asHtml}</strike>)}, fieldFilter ), "removeBtn" -> NodeSeq.Empty, "msg" -> Text(?("Deleted")) ) }: NodeSeq }, "saveBtn" -> SHtml.submit(?("Save"), onSubmit _, noPrompt) )<lift:children> <head> <title><table:title /></title> </head> <h3><table:title /></h3> <table> <thead> <tr> <header:fields> <th><field:name /></th> </header:fields> <td><table:insertBtn /></td> <td></td> </tr> <tr> <td colspan="5"> <hr /> </td> </tr> </thead> <tbody> <table:items> <tr> <item:fields> <td style="vertical-align: top"><field:form /></td> </item:fields> <td style="vertical-align: top"><item:removeBtn /></td> <td><item:msg /></td> </tr> <tr> <td colspan="5"> <hr /> </td> </tr> </table:items> </tbody> </table> <table:saveBtn /></lift:children>
<title><table:title /></title> <h3>Cats</h3> <item:fields> </item:fields><table> <thead> <tr> <th><field:name></field:name></th> <td><table:insertbtn></table:insertbtn></td> <td></td> </tr> <tr> <td colspan="5"> <hr> </td> </tr> </thead> <tbody> <tr> <td style="vertical-align: top"><field:form></field:form></td> <td style="vertical-align: top"><item:removebtn></item:removebtn></td> <td><item:msg></item:msg></td> </tr> <tr> <td colspan="5"> <hr> </td> </tr> </tbody>
</table> <table:savebtn>