代码之家  ›  专栏  ›  技术社区  ›  Frank

我在extjs提供的布局浏览器示例中放入的extjs xml树示例

  •  0
  • Frank  · 技术社区  · 16 年前

    下面是一个javascript变量,我正使用它加载到布局浏览器中…您会注意到listener部分被注释掉了…当我取消注释这个部分时,布局浏览器和树不会显示出来。当我注释掉listener部分时,除了listener填充pool details面板外,布局浏览器和树工作正常。

    你知道为什么监听器会弹出布局浏览器和树的渲染吗?

    var PoolStackTree = {
      id: 'PoolStackTree-panel',
      title: 'Pool List',
      layout: 'border',
      width: 500,
      height: 500,
      items: [{
        xtype: 'treepanel',
        id: 'pooltree-panel',
        region: 'center',
        margins: '2 2 0 2',
        singleExpand: true,
        animate: true,
        useArrows: true,
        autoScroll: true,
        rootVisible: false,
        root: new Ext.tree.AsyncTreeNode(),
        loader: new Ext.app.PoolLoader({ dataUrl: 'calmonpool_views_xml.cgi' })
    /*
        listeners { 'render': function(tp) {
          tp.getSelectionModel().on('selectionchange', function(tree-pool, node-pool) {
            var el = Ext.getCmp('pool-details-panel').body;
            if(node-pool && node-pool.leaf) {
              tpl.overwrite(el, node-pool.attributes);
            } else {
              el.update(detailsText);
            }
          })
        }}
    */
      },{
        id: 'pool-details-panel',
        title: 'Pool Details',
        region: 'south',
        autoScroll: true,
        collapsible: true,
        split: true,
        margins: '0 2 2 2',
        cmargins: '2 2 2 2',
        height: 220,
        html: detailsText
      }]
    };
    
    2 回复  |  直到 16 年前
        1
  •  0
  •   Ates Goral    16 年前

    “listeners”属性名称前缺少逗号,属性名称后缺少冒号:

    ...,
    listeners: { ...
    
        2
  •  0
  •   Eric Wendelin    16 年前

    首先,你在“听众”后面缺少一个“:”。这肯定会导致树无法渲染。