Results 1 to 4 of 4

Thread: XTemplate - List<String>

  1. #1
    Sencha Premium User
    Join Date
    Sep 2009
    Posts
    311
    Vote Rating
    1
      0  

    Default XTemplate - List<String>

    MyModel.java
    Code:
    private String name;
    private List<String> products;
    How I can implement a XTemplate that can iterate on a List<String> ?

    I try...
    Code:
        private String getTemplate() {
    
            final StringBuilder sb = new StringBuilder();
    
            sb.append("<p>Name: {name}</p>");
            sb.append("<tpl for='products'>");
            sb.append("<tpl>{value}</tpl>"); // of course that it is wrong....
            sb.append("</tpl>");
    
            return sb.toString();
        }
    only the name appears...

    thanks

  2. #2
    Sencha User
    Join Date
    Jun 2010
    Location
    Cajamarca, Peru
    Posts
    42
    Vote Rating
    0
      0  

    Default

    Look here : http://www.sencha.com/examples/explorer.html#templates
    You can see that templates provide for and if statements.

  3. #3
    Sencha Premium User
    Join Date
    Sep 2009
    Posts
    311
    Vote Rating
    1
      0  

    Default

    thanks... but dont have one example that use List<String>...
    .....


    Client
    Code:
    private String name;
    private List<Customer> customers;

    Customer

    Code:
    private String name;
    using rowExpander
    Code:
    final XTemplate tpl = XTemplate.create("<tpl for='customers'><tpl>{name}</tpl></tpl>");
    
    RowExpander expander = new RowExpander();
    expander.setTemplate(tpl);
    but dont work.....

    how I can iterate in one list using XTemplate on RowExpander?

    thanks

  4. #4
    Sencha Premium User
    Join Date
    Sep 2009
    Posts
    311
    Vote Rating
    1
      0  

    Default

    one day to discovery that

    'customers' should be \"customers\"
    so work

Similar Threads

  1. DataView XTemplate multi dimensional Json string
    By JackCo in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 15 Nov 2010, 12:53 PM
  2. List XTemplate Question
    By danvega in forum Sencha Touch 1.x: Discussion
    Replies: 6
    Last Post: 21 Jul 2010, 7:14 AM
  3. String manipulation on variable in XTemplate
    By clavinovahan in forum Ext GWT: Discussion
    Replies: 4
    Last Post: 4 May 2010, 9:51 AM
  4. static json string display as combo list.
    By nityajs in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 6 Aug 2009, 4:24 PM
  5. Xtemplate combo: List not expanded
    By randomuser01 in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 22 Oct 2008, 11:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •