I have this one page that has about 20 fields, they all show
information about a product, so they are all related.
In my html file, I have two main divs
<div main info ... cometClass></div>
<div secondary info ... cometClass></div>
...
My render method has css rules to match the span tags from both, main
and secondary sections. But when I run my unit test using S.template
or even when I visit the page on the browser, what ends up happening
is that the html of the main info section is shown on both, the main
and secondary div.
I know I could split my render into two methods, but I was wondering
if I could keep them all in one, because while looking at the scala
code, it does not make much sense to separate them, I only separate
them because of UI requirements.
Thanks
Diego
--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
> Hi,
>
> I have this one page that has about 20 fields, they all show
> information about a product, so they are all related.
>
> In my html file, I have two main divs
>
> <div main info ... cometClass></div>
> <div secondary info ... cometClass></div>
>
> ...
>
> My render method has css rules to match the span tags from both, main
> and secondary sections. But when I run my unit test using S.template
> or even when I visit the page on the browser, what ends up happening
> is that the html of the main info section is shown on both, the main
> and secondary div.
>
> I know I could split my render into two methods, but I was wondering
> if I could keep them all in one, because while looking at the scala
> code, it does not make much sense to separate them, I only separate
> them because of UI requirements.
You know the drill, provide example code :-)
Is it the same if you remove the comet stuff?
/Jeppe
jeje, I should know better, I'll put one together and post back
>
> Is it the same if you remove the comet stuff?
you mean use a regular snippet? I did not try, but will try and let you know
Thanks
Diego
>
> /Jeppe
>
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
--
Thanks David, I'm still trying to reproduce it on a smaller sample. Of
course it works just fine on the demo (the initial render, I did not
try to send a partialUpdate )
I did notice that even on my real application, the only way to trigger
this is by first running a unit test that tests this snippet using
testS {} and then start jetty.
I I first start sbt, then jetty, the page renders normally.
I'll keep working on this and post back as soon as I know more (and
hopefully can get a small sample showing what I see)
Thanks
Diego
Diego
This only happens in run.mode=test :)
Full project using sbt 0.7.7 including sbt launcher and everything you
need it at
https://github.com/fmpwizard/single_comet_two_div
Thanks
Diego
Ah, after I sent this email I figured out why the demo was not doing
the same thing.
This only happens in run.mode=test :)
Full project using sbt 0.7.7 including sbt launcher and everything you
need it at
https://github.com/fmpwizard/single_comet_two_div
Diego
Sent from my android cell
On Feb 6, 2012 3:31 PM, "David Pollak" <feeder.of...@gmail.com> wrote:
>
>
>
> On Thu, Feb 2, 2012 at 9:46 PM, Diego Medina <di...@fmpwizard.com> wrote:
>>
>> Ah, after I sent this email I figured out why the demo was not doing
>> the same thing.
>>
>> This only happens in run.mode=test :)
>>
>> Full project using sbt 0.7.7 including sbt launcher and everything you
>> need it at
>> https://github.com/fmpwizard/single_comet_two_div
>>
>
> You cannot have two instances of the same Comet component on the same page. Each comet component must be unique. You have <lift:comet type="helloworld" name="Other"> on the index.html page twice. That breaks the Comet paradigm and will not work.
>
> The reason is that the CometActor exists outside the context of a given page. In order to draw itself, the CometActor is given a DOM (NodeSeq) that it re-uses. In dev mode, the DOM is passed each time the CometActor is encountered on a page. In non-dev-mode, the DOM is presented to the CometActor the first time it is encountered and the CometActor caches the DOM.
>
> Hope this helps.
>
Yes it does and I'm actually happier now that I split it into several comet actors.
Thanks!
Diego
I was thinking about this a bit more today and I wonder if it would
make sense to change the dev-mode behavior . I mean, just looking at
this aspect of dev-mode, it would seem better to use the cache NodeSeq
on all modes. What do you think?
Thanks
Diego
Diego
Sent from my android cell
On Feb 7, 2012 12:37 AM, "David Pollak" <feeder.of...@gmail.com> wrote:
>
> -1 the dev mode behavior allows you to reload a page with a new template and see the new template reflected in the comet actor. If the caching behavior was in dev mode you'd have to restart the app each time you made a template change.
Ah,I see, I thought there was a good reason.
Thanks
Diego
Sent from my android cell
On Feb 7, 2012 12:31 AM, "Franz Bettag" <fr...@bett.ag> wrote:
>
> diego +1, make it the same over all modes. saves issues/confusion.
>
> To help your case (i didnt read everything), have you tried subclassing your CometActor? not sure it works, but give it a try.
>
I went ahead and now I use two different cometactors and all us well, thanks
Diego