You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ReExt中正常的tbar与bbar在Sencha CMD中无法渲染,求技术协助

Sencha CMD社区版中Grid的tbar/bbar无法渲染问题

我同时使用ReExt(搭配Vite)和Sencha CMD社区版开发项目,ReExt中Grid的tbar和bbar功能可正常工作,但在Sencha CMD社区版中复现相同逻辑时,出现tbar和bbar无法渲染的问题。

以下是我的实现代码:

Ext.define('SwApp.view.swuserlist.SwuserlistView', {
  extend: 'Ext.panel.Panel',
  xtype: 'swuserlistview',
  controller: { type: 'swuserlistviewcontroller' },
  viewModel: { type: 'swuserlistviewmodel' },
  layout: 'vbox',
  items: [
    {
      xtype: 'grid',
      reference: 'userGrid', 
      flex: 6,
      style: { width: '80%' },
      plugins: 'gridfilters', 
      tbar: [
        '->',
        {
          text: 'Refresh',
          iconCls: 'fa fa-sync',
          handler: 'onRefreshClick',
        },
        {
          text: 'New User',
          iconCls: 'fa fa-plus',
          handler: 'onNewUserClick',
        },
      ],
      bbar: {
        xtype: 'pagingtoolbar',
        displayInfo: true,
        bind: {
          store: '{users}', 
        },
      },
      columns: [
        { text: 'User ID', dataIndex: 'id', width: 120 },
        { text: 'First Name', dataIndex: 'name', width: 200 },
        { text: 'Last Name', dataIndex: 'username', width: 200 },
        { text: 'Email', dataIndex: 'email', width: 200 },
      ],
      bind: '{users}', 
      listeners: {
        select: 'onGridSelect',
      },
    },
    {
      xtype: 'panel',
      reference: 'detailsPanel',
      flex: 2, 
      tpl: new Ext.XTemplate(
        '<div><strong>User ID:</strong> {id}</div>',
        '<div><strong>First Name:</strong> {name}</div>',
        '<div><strong>Last Name:</strong> {username}</div>',
        '<div><strong>Email:</strong> {email}</div>',
      ),
      data: {}, 
    },
    {
      xtype: 'button',
      text: 'Click Me',
      handler: 'onButtonClick',
      margin: '10 0 0 0',
    },
  ],
});

预期结果

  • tbar显示“Refresh”和“New User”按钮
  • bbar显示分页控件

实际情况

  • 网格可正确加载并显示store数据
  • 开发者工具检查网格元素时,未发现tbar、bbar或分页按钮的痕迹
  • 已确认gridfilters插件可用,store数据绑定正常

求社区提供见解或协助解决此问题,若有人遇到过类似问题或能指明排查方向,将不胜感激。

内容的提问来源于stack exchange,提问作者Harihar Nagarajan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 15:32:03