0

ExtJs 6.0.0 と Sencha Cmd 6.0.2 を使用し、MVC アーキテクチャを使用しています。以下のように、Sencha Cmd によって生成されたテスト用のシンプルなアプリがあります。

// MyApp/store/Personnel.js

Ext.define('MyApp.store.Personnel', {
  extend: 'Ext.data.Store',

  alias: 'store.personnel',


  fields: [
    'name', 'email', 'phone'
  ],

  data: {
    items: [{
      name: 'Jean Luc',
      email: "jeanluc.picard@enterprise.com",
      phone: "555-111-1111"
    }]
  },

  proxy: {
    type: 'memory',
    reader: {
      type: 'json',
      rootProperty: 'items'
    }
  }
});

// MyApp/app/view/main/List.js

Ext.define('MyApp.view.main.List', {
  extend: 'Ext.grid.Panel',
  xtype: 'mainlist',

  requires: [
    'MyApp.store.Personnel'
  ],

  title: 'Personnel',

  store: 'Personnel',
  //store: {
  //    type: 'personnel'
  //},

  columns: [{
    text: 'Name',
    dataIndex: 'name'
  }, {
    text: 'Email',
    dataIndex: 'email',
    flex: 1
  }, {
    text: 'Phone',
    dataIndex: 'phone',
    flex: 1
  }],

  listeners: {
    select: 'onItemSelected'
  }
});

// MyApp/app/Application.js

Ext.define('MyApp.Application', {
    extend: 'Ext.app.Application',
    
    name: 'MyApp',

    stores: [
        // TODO: add global / shared stores here
        'Personnel'
    ]  
});

それは、 Listのビューで人事店の短い名前 (名前空間なしの Classname のみ) を使用したいのですが、うまくいきません。しかし、Ticket App (SDK でも Sencha 公式が推奨する例) では、このように使用して完全に動作しますが、なぜ私のものは正しく動作しないのでしょうか? app.json は同じように見えました。

4

1 に答える 1

0

store: 'foo'id のストアを意味しfooます。そのストアには、すでにインスタンスが作成されている必要があります。

typeそこでコメントアウトした構文を使用する必要があります。

于 2015-10-18T11:43:46.827 に答える