2 Replies Latest reply on May 8, 2014 10:02 PM by Gerardo Monasterios

    Errai UI - Widgets not referenced in the template html

    Gerardo Monasterios Newbie

      Hi all,

       

      I have been doing some proof of concept with Errai UI  and so far it seems very powerful but I have some questions about templating (Mapping template html fields with its Class DataFields).

      Based on the Errai tutorial we have part of the Admin.html that looks like:

      <table class="table striped blackened">

                <tbody id="complaints">

                  <tr id="complaint" valign="top" class="issue-open">

                    <td data-field="name">Lincoln Baxter, III</td>

                    <td data-field="email">lincolnbaxter@gmail.com</td>

                     ...

                  </tr>

      </table>

       

      And the template class related to each row is ComplaintListItemWidget that looks like

      @Templated("Admin.html#complaint")

      public class ComplaintListItemWidget extends Composite implements HasModel<UserComplaint> {

        @Inject

        @AutoBound

        private DataBinder<UserComplaint> userComplaint;

      ...

          @Bound

        @DataField

        private final Element name = DOM.createTD();

       

        @Bound

        @DataField

        private final Element email = DOM.createTD();

      ...

       

      My question is: if I need to remove the email TD of the template html, then it also must be removed from the ComplaintListItemWidget class?. Is there a more flexible way to go (like mark the @Datafield not mandatory for example) in the template to put or remove things.

       

      Thanks in advance for your answer