3 Replies Latest reply on Feb 4, 2014 5:43 PM by mbarkley

    Possible bug in template eng

    rathiandi

      I was trying to build a grid and ended up creating a List widget and another widget to represent row and associated templates as below:

       

      List Widget:

      <div class="content-section-b">

        <div class="container">

        <table class="table"> 

        <thead> 

         <tr> 

           <th>Student-ID</th> 

           <th>First Name</th> 

           <th>Last Name</th> 

           <th>Grade</th> 

         </tr> 

        </thead> 

           <tbody id="mediaList">

           </tbody> 

        </table> 

        </div>

      </div>

       

      Row Widget:

        <tr id="mediaRow"> 

           <td>001</td> 

           <td>Rammohan </td> 

           <td>Reddy</td> 

           <td>A+</td> 

        </tr> 

       

      In my opinion, it should work but no it doesn't. Errai complain that no root element available for Row Widget. But if I move row template in List Widget like below and refer it via  @Templated("ListWidget.html#mediaRow") it works. Not sure if i am missing something or is it a bug? But i am loving the framework and though will put it into your notice.


      <div class="content-section-b">

        <div class="container">

        <table class="table"> 

        <thead> 

         <tr> 

           <th>Student-ID</th> 

           <th>First Name</th> 

           <th>Last Name</th> 

           <th>Grade</th> 

         </tr> 

        </thead> 

           <tbody id="mediaList">

      <tr id="mediaRow"> 

           <td>001</td> 

           <td>Rammohan </td> 

           <td>Reddy</td> 

           <td>A+</td> 

        </tr> 

           </tbody> 

        </table> 

        </div>

      </div>

       

      Thanks,

        • 1. Re: Possible bug in template eng
          mbarkley

          Hi Amit,

           

          I think the issue may have occurred because your row widget template had a <tr> element as it's root, which I believe is not valid html. If you want to have your row widget in a separate file, you could try making a RowWidget.html file with a full table in it and reference the row the same way your are doing now: @Templated("RowWidget.html#mediaRow")

           

          Cheers.

          • 2. Re: Possible bug in template eng
            rathiandi

            That's right; it start from <tr> and i did the same thing what you have recommended. Just Curious  - Why don't we consider <tr> as root?

            • 3. Re: Re: Possible bug in template eng
              mbarkley

              The <tr> tag needs to be nested in a <table> tag. For example, try loading this in your web browser:

              <html>
              <head><title>test</title></head>
              <body>
                <tr><td>test</td></tr>
              </body>
              

               

              If you load it in Chrome and look at the source with the inspector, you'll see that it strips the <tr> and <td> tags away, so that the text is a direct child of the <body>.