0

我正在使用咖啡脚本在 ExtJS 4.2 MVC 样式应用程序中工作并尝试使用 rowExpander。网格似乎没有呈现“rowBodyTpl”,每当我单击以展开该行时,我都会收到一个错误:“未捕获的 TypeError:无法调用 null 的方法 'removeCls'”和“未捕获的 TypeError:无法调用”方法 'addCls' of null ' 任何见解或建议将不胜感激。

Ext.define( "Test.view.ExpandGrid",
    extend: "Ext.grid.Panel"

    alias: "widget.test-view-expandGrid"
    controller: "Test.controller.ExpandGridController"
    requires: [ "Ext.data.*", "Ext.grid.*", "Ext.grid.plugin.RowExpander" ]
    inject: [ "testStore" ]

    config:
      testStore: null

    plugins: [{
      ptype: 'rowexpander',
      rowBodyTpl : [
        'something'
      ]
    }]

    initComponent: ->

      Ext.apply( @,

        store: @getTestStore()

        columns: [
          { text: "field1", dataIndex: "field1_data" },
          { text: "field2", dataIndex: "field2_data"  },
          { text: "field3", dataIndex: "field3_data" }
        ],
        features: [
          ftype: "rowbody",
          ftype: "rowwrap"
        ]




)

@callParent( arguments )

)
4

1 回答 1

0

我不使用coffeescript,所以我不得不进行一些更改以使其成为纯JS。您可以在此处查看代码\运行它。如您所见,它工作得非常好。也许尝试从您的 Coffee 脚本生成 JS 并将其与我的示例进行比较。

除了删除 Coffescript、删除 DeftJS 特定部分和添加我自己的内存存储所需的更改之外,最大的更改可能是:

  1. 个别特征周围缺少括号
  2. 调用 Ext.applyIf 而不是 Ext.apply
于 2014-01-09T17:24:26.313 回答