Message from discussion
Dynamically addFields(...) of LiftScreen by use ScreenVar failed in a loop.
Received: by 10.68.231.2 with SMTP id tc2mr2932905pbc.8.1336577693704;
Wed, 09 May 2012 08:34:53 -0700 (PDT)
X-BeenThere: liftweb@googlegroups.com
Received: by 10.68.229.197 with SMTP id ss5ls1366356pbc.2.gmail; Wed, 09 May
2012 08:34:49 -0700 (PDT)
Received: by 10.68.241.6 with SMTP id we6mr330358pbc.10.1336577689029;
Wed, 09 May 2012 08:34:49 -0700 (PDT)
Date: Wed, 9 May 2012 08:34:48 -0700 (PDT)
From: Sam <s...@samuel.pro>
To: liftweb@googlegroups.com
Message-ID: <23303576.2137.1336577688472.JavaMail.geo-discussion-forums@pbcoz4>
Subject: Dynamically addFields(...) of LiftScreen by use ScreenVar failed in
a loop.
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_2135_2615640.1336577688471"
------=_Part_2135_2615640.1336577688471
Content-Type: multipart/alternative;
boundary="----=_Part_2136_4762933.1336577688472"
------=_Part_2136_4762933.1336577688472
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
val books: List[Book] = Books.all //Book is MappedOneToMany Object
books match {
case Nil => "was an empty list"
case x :: xs => {
object book extends ScreenVar(xs)
addFields(() => book) // error: type mismatch;
//[INFO] found : book.type (with underlying type object up)
//[INFO] required: net.liftweb.util.FieldContainer
//[INFO] addFields(() => book)
}
}
------=_Part_2136_4762933.1336577688472
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<p class=3D"p1"></p><p class=3D"p1">
</p><p class=3D"p1"></p><p class=3D"p1"></p><p class=3D"p1">
</p><p class=3D"p1"></p><p class=3D"p1">
</p><p class=3D"p1"><span class=3D"s1">val</span> books: List[Book] =3D Boo=
ks.all //Book is MappedOneToMany Object</p><p></p><p class=3D"p1=
">books match {</p><p class=3D"p1"> case Nil =3D> "was an e=
mpty list"</p><p class=3D"p1"> case x :: xs =3D> {</p><p cl=
ass=3D"p1"> object book extends ScreenVar(xs)</p><p cla=
ss=3D"p1"><font color=3D"#ff0000"> addFields(() =3D>=
book) // error: type mismatch;<br></font><span style=3D"color: rgb(25=
5, 0, 0); ">//[INFO]</span><span style=3D"color: rgb(255, 0, 0); "> <=
/span><span style=3D"color: rgb(255, 0, 0); ">found </span><span style=3D"c=
olor: rgb(255, 0, 0); "> </span><span style=3D"color: rgb(255, 0, 0);=
">: </span><span style=3D"color: rgb(255, 0, 0); ">book</span><span s=
tyle=3D"color: rgb(255, 0, 0); ">.type (with underlying type object up)<br>=
</span><span style=3D"color: rgb(255, 0, 0); ">//[INFO]</span><span style=
=3D"color: rgb(255, 0, 0); "> </span><span style=3D"color: rgb(255, 0=
, 0); ">required: net.liftweb.util.FieldContainer<br></span><span style=3D"=
color: rgb(255, 0, 0); ">//[INFO] </span><span style=3D"color: rgb(255, 0, =
0); "> </span><span style=3D"color: rgb(255, 0, 0); ">a=
ddFields(() =3D> book)</span></p><p class=3D"p1"> }</p><p c=
lass=3D"p1"> }</p><p></p><p></p><p></p><p></p><p></p><p></p>
------=_Part_2136_4762933.1336577688472--
------=_Part_2135_2615640.1336577688471--