Re: [Lift] How to reRender the page via js in Chat demo of the lift ?

2009-12-28 Thread Derek Chen-Becker
If you never want to show more than 5 chats, you need to move the logic for
trimming to 5 chats into the line where you calculate the update. It looks
like you're trying to just update the difference between the incoming
updates and your current chats.

Derek

On Sat, Dec 19, 2009 at 3:47 AM, Neil.Lv anim...@gmail.com wrote:

 Hi all,

  How to reRender the page via js in Chat demo of the lift ?

  Here is an example:
 ###  In the index page, show all the message that the users sent
 user 1: message 1
 user 2: message 2
 user 3: message 3
 user 4: message 4
 user 5: message 5
 ###

  Here are 5 messages, then i want to refresh the messages when the
 message count 5,
 ###
 user 1: message 1
 user 2: message 2
 user 3: message 3
 user 4: message 4
 user 5: message 5
 refresh:  can't refresh, also show 6 messages, i want to show 5
 messages.
 ###

  Here is code in the Comet:
 ###
 lass Chat extends CometActor with CometListener {
 ...
  override def lowPriority = {
case ChatServerUpdate(value) =
  val update = (value -- chats).reverse.map(b = AppendHtml
 (infoId, line(b)))
  partialUpdate(update)
  chats = value.take(5)
  }
 ...
 }
 ###

   In the example, when the message counts =5, i set the count to 5
 via
  ###
  chats = value.take(5)
 ###

   Is there a js function can do this, when the chats's size is bigger
 than 5, then refresh the messages.

  Thanks for any suggestion!

 Cheers,
  Neil

 --

 You received this message because you are subscribed to the Google Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




[Lift] How to reRender the page via js in Chat demo of the lift ?

2009-12-19 Thread Neil.Lv
Hi all,

  How to reRender the page via js in Chat demo of the lift ?

  Here is an example:
###  In the index page, show all the message that the users sent
user 1: message 1
user 2: message 2
user 3: message 3
user 4: message 4
user 5: message 5
###

  Here are 5 messages, then i want to refresh the messages when the
message count 5,
###
user 1: message 1
user 2: message 2
user 3: message 3
user 4: message 4
user 5: message 5
refresh:  can't refresh, also show 6 messages, i want to show 5
messages.
###

  Here is code in the Comet:
###
lass Chat extends CometActor with CometListener {
...
  override def lowPriority = {
case ChatServerUpdate(value) =
  val update = (value -- chats).reverse.map(b = AppendHtml
(infoId, line(b)))
  partialUpdate(update)
  chats = value.take(5)
  }
...
}
###

   In the example, when the message counts =5, i set the count to 5
via
 ###
 chats = value.take(5)
###

   Is there a js function can do this, when the chats's size is bigger
than 5, then refresh the messages.

  Thanks for any suggestion!

Cheers,
  Neil

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.