It's not too hard to make your own without ajax.
def addRemove(c: Child) = (_:Boolean) match {
case true => if(!field.contains(c)) field+=c
case false => field -= c
}
Then iterate (flatMap) over Child.findAll creating a checkbox initialized to
field.contains(x) with addRemove(x) as its setter.
-------------------------------------
Kevin Wright<[email protected]> wrote:
Absolutely spot-on article here about multiple selection on webpages:
http://www.ryancramer.com/journal/entries/select_multiple/
I'm a big fan of asmselect, and the real beauty is that we already have
jquery support in lift out-of-the-box :)
<http://www.ryancramer.com/journal/entries/select_multiple/>
On Thu, Aug 20, 2009 at 11:27 PM, glenn <[email protected]> wrote:
>
> Naftoli,
>
> I like the checkboxes style for a small selection (say 10 or less),
> and perhaps a multi-selectbox if the choices are more numerous.
> Another approach is to use two list boxes, one for the choices and
> another for the selections, with maybe a drag-and-drop capability or
> some add/remove buttons in between. I guess there is no good default
> solution.
>
> One enhancement to your tableeditor would be a tableviewer option,
> using a <field:toXml> instead of a <field:form> tag.
>
> Thanks for your help.
>
> Glenn...
>
> On Aug 20, 2:20 pm, Naftoli Gugenheim <[email protected]> wrote:
> > The name is really a misnomer. It's not a MappedField. So it's missing
> the opposite half: it _is_ the "validSelectValues" but it doesn't have the
> toForm method of MappedField's to make use of its values.
> > I'm not sure how a hypothetical "toForm" would work for a many-to-many
> "field." Actually it depends on the circumstances. One option is how MS
> Access works---every time you select a value you get a new blank row. This
> is good where you can have many or duplicate children, but is more complex
> to implement. Similarly you can have a list of current children and a
> dropdown to add. Another option (where duplicates are not allowed) is a set
> of checkboxes.
> >
> > -------------------------------------
> >
> > glenn<[email protected]> wrote:
> >
> > Naftoli,
> >
> > Sorry for the addendum, but ideally, it would be nice to
> > do something like:
> >
> > override def validSelectValues: Box[List[(Long, String)]] ...
> >
> > as you can with MappedLongForeignKey, and have a select box
> > display in the table.
> >
> > Glenn...
> >
> > On Aug 20, 12:51 pm, glenn <[email protected]> wrote:
> >
> > > Naftoli,
> >
> > > I tried using TableEditor with a MetaMapper instance of a ManyToMany
> > > class, but <header:fields> and
> > > <item:fields> tags in the template didn't pick up the MappedManyToMany
> > > object in the class.
> >
> > > Is there some method that I need to override,or is there some way to
> > > write the template that will
> > > resolve this?
> >
> > > Glenn...
> >
> > > On Aug 12, 2:48 pm, Naftoli Gugenheim <[email protected]> wrote:
> >
> > > > I just wrote a brief wiki article on GitHub about using TableEditor,
> but not
> > > > being familiar with the formatting syntax, the code snippets are
> truncated.
> > > > Can anyone take a look at it and fix it? Thanks.
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---