-
9 Apr 2010 7:39 AM #1
ComboBox Template
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:
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.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>' );
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
-
15 Apr 2010 8:21 AM #2
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>' );


Reply With Quote