I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
("todos").open_!

Here's my layout:

todo.html template ================

<lift:TD.listTodos todos="todos">
--- Todo list table stuff ---
<lift:TD.listTags tags="tags">
--- Tag list table stuff (where the selection to filter comes from)
---

TD.scala snippet =================

// this arity is for the default 'show all Todos' condition
def list(html: NodeSeq) = {
    val id = S.attr("todos").open_!

// this arity is for the 'filter by Tag' case
def list(filterTag: Long)(html: NodeSeq) = {
    val id = S.attr("todos").open_!

The two snippet methods could probably be combined with a (param:
Long*) signature, but Scala does not seem to care right now. The
default works perfectly, but when a Tag is selected to filter by, the
'todos' id Box cannot be seen when attempting to open.

Is this because it is probably out of scope? I am using an ajaxbutton
to make the call and pass in the tag.id, but it is hard to see how an
S.attr could exist for one request, then be gone for the next, unless
I am confusing this with a stateful attribute.


On Jul 1, 2:42 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> On Wed, Jul 1, 2009 at 2:28 PM, g-man <gregor...@gmail.com> wrote:
>
> > I will look into the nested snippets.
>
> > For expediency, I folded all the snippets that interact with my
> > template into one file, so I can concentrate on the business logic.
>
> > For my Todo app enhancement, I need to pass the id of my selected Tag
> > (which I have confirmed is correctly gathered from the page request)
> > in to the TD.list method, so that the filtered Todos (those bearing
> > the required Tag) will be found and rendered.
>
> > My problem is that if I try to pass an additional argument (tagId:
> > Long), the TD.list method is not happy and will not even render the
> > template.
>
> > I have tried both paired (html: NodeSeq, tagId: Long) as well as
> > curried style (html: NodeSeq)(tagId: Long), but neither works.
>
> Try:
>
> list(tagId: Long)(html: NodeSeq): NodeSeq
>
> That way list(44L) _ becomes a NodeSeq => NodeSeq
>
>
>
>
>
> > There must be a simple way to accomplish such a common task!
>
> > Thanks to all the members for commenting...
>
> > On Jun 29, 11:25 pm, "marius d." <marius.dan...@gmail.com> wrote:
> > > Or you can use S.locateMappedSnippet ... but first try to see if
> > > nested snippet won't do the trick for you ...
>
> > > On Jun 30, 10:17 am, "marius d." <marius.dan...@gmail.com> wrote:
>
> > > > Can you paste some code?
>
> > > > Essentially we support nested snippets so your snippet can simply
> > > > return a markup containing another snippet and it will be invoked. If
> > > > you really want to manually invoke a snippet from another snippet and
> > > > if you are not using StatefulSnippets you can just instantiate the
> > > > class and call your function and pass it the right NodeSeq.
>
> > > > Br's,
> > > > Marius
>
> > > > On Jun 30, 5:36 am, g-man <gregor...@gmail.com> wrote:
>
> > > > > I am enhancing the Todo app by adding tags.
>
> > > > > I have retained the TD.scala snippet to manage the Todos on my page,
> > > > > and added a TG.scala snippet to handle tags on the same page, which
> > > > > works well for creating new and listing in both cases.
>
> > > > > Now I want to filter my Todos list by a Tag instance I select from my
> > > > > list, and therefore need to pass the id of the selected tag over from
> > > > > the TG snippet to the TD snippet, where it can be used as a filter
> > > > > argument for a find method.
>
> > > > > The problem is that scala says it cannot find snippet TD, whose
> > method
> > > > > I am calling as TD.list from the TG.scala snippet. I have tried all
> > > > > kinds of explicit importing, but no luck.
>
> > > > > So,  can a snippet call a snippet, or is that controlled only from
> > the
> > > > > web page?- Hide quoted text -
>
> > > - Show quoted text -
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp
--~--~---------~--~----~------------~-------~--~----~
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