我的ListItems始終顯示爲空白且沒有文字。Sencha Touch 2:ListItems爲空
最初,我的項目使用{field_name}簡單地使用List對象的itemTpl定義進行格式化。這工作正常,但當然功能有限。
因此,我使用dataMap查看了DataView的ST2文檔指南(http://docs.sencha.com/touch/2-1/#!/guide/dataview),並試圖複製它。但是,無論出於何種原因,我似乎無法獲得實際呈現的內容。我得到了預期的結果數量,披露行爲確實打開了正確/相應的記錄。只是這些項目都是空白的,沒有文字。
商店通過代理加載JSON數據。數據有很多領域,其中一個叫做「標題」。現在,這就是我想要的樣式和顯示在列表項中。基於「標題」內容,我可以對事物進行不同的表述。
像往常一樣,任何幫助,非常感謝。謝謝!
穆罕默德。
加利福尼亞州聖何塞,
我的列表對象:
Ext.define('qxtapp.view.ResultsList', {
extend: 'Ext.dataview.List',
alias: 'widget.resultsList',
xtype: 'resultsList',
requires: [
'qxtapp.view.ResultsListItem',
'Ext.plugin.ListPaging'
],
config: {
defaultType: 'resultslistitem',
loadingText: 'Performing search...<br>This may take up to 1 minute.',
emptyText: 'No results found.',
useComponents: true,
store: 'SearchResults',
onItemDisclosure: true,
plugins: [
{
xclass: 'Ext.plugin.ListPaging',
autoPaging: true
}
]
}
});
我ListItem對象:
Ext.define('qxtapp.view.ResultsListItem', {
extend: 'Ext.dataview.component.ListItem',
xtype : 'resultslistitem',
config: {
captionPanel: true,
dataMap: {
getCaptionPanel: {
setText: 'caption'
}
}
},
applyCaptionPanel: function(config) {
return Ext.factory(config, Ext.Panel, this.getCaptionPanel());
},
updateCaptionPanel: function(newCaptionPanel, oldCaptionPanel) {
if(oldCaptionPanel) {
this.remove(oldCaptionPanel);
}
if(newCaptionPanel) {
this.add(newCaptionPanel);
}
}
});
這也幫助了我的情景。日Thnx – 2014-06-27 17:09:49