Tablesorter and Ajax/Comet

5 views
Skip to first unread message

Tom Fiedler

unread,
Oct 29, 2009, 12:33:36 PM10/29/09
to Lift
Hi all,

i'm having a problem using the Tablesorter-widget in combination with
Comet. Everything works fine until i replace the table with an updated
one using the SetHtml command from inside a CometActor. The new table
has the same id (it's actually the exact same table-template, along
with the call for the TableSorter-Snippet) but from what i read i need
to re-call the ("#table").tablesorter() method, so that the
functionality is applied to the updated table elements.

Are there any suggestions on how to archieve this? Where do i have to
place that call?

Thanks
Tom

Tom Fiedler

unread,
Oct 30, 2009, 10:14:39 AM10/30/09
to Lift
i found the solution myself, it's easy once you know it, but i share
it anyway since it might be usefull for noobs like myself:

in order to get the tablesorter to work after you update your table
you need to re-call the ("#table").tablesorter() method.
so my update-function inside my cometactor now looks like this:

def updateTable(news : News) = {
partialUpdate( SetHtml("allNewsTableInsertDiv", (<lift:embed
what="/news/tableTemplates/_allNewsTable" />)));
partialUpdate( JsRaw("""$("#table").tablesorter();"""));
}

now everything works fine
Reply all
Reply to author
Forward
0 new messages