Binding in html table

21 views
Skip to first unread message

Sukhbat Ganbold

unread,
May 20, 2016, 2:09:58 PM5/20/16
to Lift
I have easy sample like below.

<div data-lift="Sample.render">
<table>
<tr>
<th>TH</th>
</tr>
<test:row/>
</table>
</div>

class Sample {

def render(in:NodeSeq) :NodeSeq = {
bind("test", in, "row"-> <tr><td>test</td></tr>)
}

}

But i got fail html as below. What did i wrong?

<div>
<tr><td>test</td></tr><table>
<tbody><tr>
<th>TH</th>
</tr>
</tbody></table>
</div>

Antonio Salazar Cardozo

unread,
May 20, 2016, 4:18:19 PM5/20/16
to Lift
Your template must be valid HTML5. <test:row /> is not a valid child
of <table> in HTML5, so it's being booted altogether.

You should generally not be using XML-style namespaced elements
designer-friendly templating, and you generally shouldn't be using the
`bind`-style helpers, as they are deprecated in Lift 2.6 and gone altogether
in Lift 3. Use CSS selector transforms instead. In your example:


<div data-lift="Sample.render">
    <table>
        <tr>
            <th>TH</th>
        </tr>
    </table>
</div>

class Sample {

  def render = {
    "tr" #> <tr><td>test</td></tr>
  }

}

Thanks,
Antonio

Sukhbat Ganbold

unread,
May 21, 2016, 1:33:02 AM5/21/16
to Lift
Thank you for help. 
I see the reason and some sample is very old to use.

Antonio Salazar Cardozo

unread,
May 22, 2016, 1:52:24 PM5/22/16
to Lift
Yep, there are definitely a lot of old examples floating around. Feel
free to ask any other questions you have once you get going with CSS
selector transforms!
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages