Charles,
I just checked in code that has a "return false" at the end of ajaxButton.
If you've pulled the Lift source from GitHub, please do a fresh pull and an
"mvn clean install" on Lift and then give it a try.
Thanks,
David
On Mon, Dec 1, 2008 at 2:18 PM, Charles F. Munat <[EMAIL PROTECTED]> wrote:
>
> Hmm. Crap. Damn that IE.
>
> Well, I have something working in Firefox on Mac for the button. It's
> probably more complicated than it needs to be...
>
> def ajaxRemove(name: String,
> func: AFuncHolder,
> attrs: Tuple2[String, String]*): Elem = {
> val funcName = mapFunc(func)
> (<input type="button"/>) %
> ("value" -> name) %
> ("onclick" -> (makeAjaxCall(JsRaw("'" +
> funcName+"='+this.checked")) + "; return false")) %
> ("class" -> "removeButton") %
> getAttrs(attrs: _*)
> }
>
> Then:
>
> <td class="button">{FH.ajaxRemove("-",
> () => {
> val x = Model.getReference[X](classOf[X], tp.id)
> survey.technicalPotentials.remove(x)
> Model.merge(survey)
> Model.remove(x)
> Model.flush()
> Run("$('#tp" + tp.id.toString + "').hide().remove();")
> })}</td>
>
> #tp + tp.id.toString is the id of the <tr> attribute.
>
> I'll crank up the virtual machine and test it in IE.
>
> Thanks for looking at this.
>
> I could conceivably hide the row and delete all the individual inputs
> (or maybe just hide the row), but that seems pretty kludgy.
>
> Chas.
>
> David Pollak wrote:
> > Charles,
> >
> > If you're planning to deploy this app in IE, you may have an issue. My
> > experience with IE is that adding/removing <tr> doesn't always work
> > well. :-(
> >
> > What is most likely happening is that your button is inside a form. It
> > turns out that there's a race condition where sometimes the
> > XmlHttpRequest will get fired first and sometimes the form will be
> > submitted first.
> >
> > Lemme see if I can do something fancy with returning false from the
> > button ajax request to the event doesn't bubble up.
> >
> > Thanks,
> >
> > David
> >
> > On Mon, Dec 1, 2008 at 1:08 PM, Charles F. Munat <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >
> > I have a table in which each row represents an object in the
> database,
> > with each cell in the row an input bound to an attribute of the
> object.
> > I want to be able to add rows (with new, blank objects) and delete
> rows
> > (deleting both the row on the page and the associated object in the
> > database).
> >
> > I've set up a snippet method to insert a new row. It returns the
> table
> > row with all the inputs nicely bound. How do I call this with AJAX
> and
> > insert the NodeSeq into the current table?
> >
> > At the end of the row I have a [-] ajaxButton. It should delete that
> row
> > and the associated object using AJAX, but when I click it, the page
> > reloads and nothing changes.
> >
> > I've looked through the jQuery Lift stuff. Am I using the ajaxButton
> > wrong? Why would the page reload? And what methods are appropriate to
> > both updating an object (Model.remove(obj)) and deleting the row
> > ($('#rowid').remove())?
> >
> > Any help appreciated.
> >
> > Chas.
> >
> >
> >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Collaborative Task Management http://much4.us
> > Follow me: http://twitter.com/dpp
> > Git some: http://github.com/dpp
> >
> > >
>
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
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 [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
-~----------~----~----~----~------~----~------~--~---