当前位置: 代码迷 >> JavaScript >> Ext.view.View使用TPL有关问题
  详细解决方案

Ext.view.View使用TPL有关问题

热度:1233   发布时间:2013-12-29 13:07:03.0
Ext.view.View使用TPL问题
代码如下:
 {
            /// <reference path="../../ext/ext-all.js" />
            Ext.define('User', {
                extend: 'Ext.data.Model',
                fields: ["name", "title"],
                hasMany: [{ model: 'User', name: 'childrens' }]
            });

            var myStore = Ext.create('Ext.data.Store', {
                model: 'User',
                proxy: {
                    type: 'ajax',
                    url: 'user.txt',
                    reader: {
                        type: 'json',
                        root: 'users'
                    }
                },
                autoLoad: true
            });

            Ext.create('Ext.view.View', {
                width:200,
                store: myStore,
                tpl: ['<div>',
                    '<tpl for=".">',
                    '<div>',
                            '<div class="nrm_menu_banner">{name}</div>',
                            '<tpl for="childrens">',
                            '<div class="nrm_menu_content">{name}</div>',
                            '</tpl>',
                            '</div>',
                    '</tpl>',
                    '</div>'
                ],
                itemSelector: 'div.nrm_menu_content',
                overItemCls: 'hover',
                trackOver: true,
                renderTo: Ext.getBody()
            });
        }
现在遇到的问题是,如果itemSelector设置为 'div.nrm_menu_content',则报
Uncaught TypeError: Cannot read property 'internalId' of undefined错误,why???
  相关解决方案