Sencha touch 在嵌套列表中添加文本附近的图像-Sencha Touch 2

Sencha touch 在嵌套列表中添加文本附近的图像-Sencha Touch 2,sencha-touch,extjs,sencha-touch-2,nested-lists,Sencha Touch,Extjs,Sencha Touch 2,Nested Lists,我是一个新的sencha学习者,我想做的是在嵌套列表文本中添加一个图像 我试图修改KithKensink exapmle代码,这是我的嵌套列表 Ext.require('Ext.data.TreeStore', function() { Ext.define('Kitchensink.view.NestedList', { requires: ['Kitchensink.view.EditorPanel', 'Kitchensink.model.Kategori'], e

我是一个新的sencha学习者,我想做的是在嵌套列表文本中添加一个图像

我试图修改KithKensink exapmle代码,这是我的嵌套列表

    Ext.require('Ext.data.TreeStore', function() {
Ext.define('Kitchensink.view.NestedList', {
    requires: ['Kitchensink.view.EditorPanel', 'Kitchensink.model.Kategori'],
    extend: 'Ext.Container',
    config: {
        layout: 'fit',
        items: [{
            xtype: 'nestedlist',
            store: {
                type: 'tree',
                id: 'NestedListStore',
                model: 'Kitchensink.model.Kategori',
                root: {},
                proxy: {
                    type: 'ajax',
                    url: 'altkategoriler.json'
                }
            },  

            displayField: 'text',



            listeners: {
                leafitemtap: function(me, list, index, item) {
                    var editorPanel = Ext.getCmp('editorPanel') || new Kitchensink.view.EditorPanel();
                    editorPanel.setRecord(list.getStore().getAt(index));
                    if (!editorPanel.getParent()) {
                        Ext.Viewport.add(editorPanel);
                    }
                    editorPanel.show();
                }
            }
        }]
    }
});
}))

我修改了商店文件

    var root = {
        id: 'root',
        text: 'Lezzet Dünyası',
        items: [
            {
                text: 'Ana Menü',
                id: 'ui',
                cls: 'launchscreen',
                items: [
                    {
                        text: 'Et Yemekleri',
                        leaf: true,
                        view:'NestedList3',
                        id: 'nestedlist3'
                    },
                    {
                        text: 'Makarnalar',
                        leaf: true,
                        view: 'NestedList2',
                        id: 'nestedlist2'
                    },
                    {
                        text: 'Tatlılar',
                        leaf: true,
                        view: 'NestedList4',
                        id: 'nestedlist4'
                    },
                    {
                        text: 'Çorbalar',
                        view: 'NestedList',
                        leaf: true,
                        id: 'nestedlist'
                    }
                ]
            }
        ]
    };
如何编辑代码以在嵌套列表文本附近添加图像


例如,在站点中,您可以看到一个嵌套列表示例,我需要一个靠近布鲁斯、爵士、流行、摇滚的图像

通常,通过自定义
getItemTextTpl
(将其放入
Ext.NestedList
定义中,您可以做更多的事情,例如:

getItemTextTpl: function(node) {
  return '<span><img src="image_url" alt="alternative_text">{text}</span>';
}
getItemTextTpl:函数(节点){
返回“{text}”;
}
通过返回字符串定义您喜欢的模板