Results 1 to 2 of 2

Thread: ComboBox Template

  1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    80
    Vote Rating
    0
      0  

    Default ComboBox Template

    Is there an easy way to create a template for a comboBox based on the data read in the data store ?
    Right now I have something like this:

    Code:
    var resultTpl = new Ext.XTemplate(
    '<tpl for="."><div class="x-combo-list-item">',
    '<span><b>Query Date:</b>{queryDate}, StartDate:{startDate},EndDate:{endDate},
    SearchTerm:<b>{searchTerm}</b><>/span><br/>',
    '</div></tpl>'
    );
    What I would like to do is detect if any of the variables are filled (ie, startDate, endData, searchTerm) and just put the header in the template only if there is data to go with it.
    So my comboBox would look like this:

    Query Date: 04-09-2010, StartDate:03-01-2010, EndDate:04-01-2010,SearchTerm:community
    Query Date: 04-09-2010, StartDate:03-01-2010, EndDate:04-01-2010,SearchTerm:telephone
    Query Date: 04-09-2010, StartDate:03-01-2010, EndDate:04-01-2010
    Query Date: 04-09-2010, SearchTerm:community

  2. #2
    Ext User
    Join Date
    Oct 2008
    Posts
    41
    Vote Rating
    0
      0  

    Default

    You can use smth like this:



    Code:
    var resultTpl = new Ext.XTemplate(
    '<tpl for="."><div class="x-combo-list-item">',
    '<span>',
    '<tpl if="queryDate != \'\'"><b>Query Date:</b>{queryDate}, </tpl>', 
    'StartDate:{startDate},EndDate:{endDate},
    SearchTerm:<b>{searchTerm}</b></span><br/>',
    '</div></tpl>'
    );

Posting Permissions

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