2016-07-28 73 views
4

嗨技术高手没有产生, 我与“Rowwidget”插件的帮助下创建了嵌套网格中的Ext JS 6.2。但是我已经获得了外部网格。但是,它没有显示内部网格。网格嵌套在Ext JS的6.2

我跟着这个Sencha code example

我的代码在缴费: Sencha Fiddle

在此先感谢...

+0

你跟着它,但你忽略了变量名称和型号名称都是经过仔细选择的。您的公司记录没有名为ordersListJSONArray的模型字段,因为没有将公司作为关联的ordersListJSONArrayModel。所以'{record.ordersListJSONArray}'指向无处不在。 – Alexander

+0

感谢您的建议@Alexander。但是,如果您在Sencha小提琴中分享更正的代码,那可能会很好。 Regards, – guruprabhus

+0

Thanks @Alexander。刚才我明白你的观点。此外,我们必须遵循命名标准,同时在** Ext商店**中映射另一个模型。如果没有** RESTFUL ** api服务电话,我们也无法做到这一点。 – guruprabhus

回答

1

按照煎茶文档: http://docs.sencha.com/extjs/6.2.1/classic/Ext.data.schema.Association.html#ext-data-schema-association_association-concepts

在这种情况下,性能的参考文件应该如下:

  • 类型:该名家长型号
  • 逆:函数的名称,它应该会返回子店(这名字,你应该参照,在小部件存储绑定)

变化的orderModel:

var orderMDL = Ext.define('orderModel', { 
extend: 'Ext.data.Model', 

fields: [ 
// Declare an association with Company. 
// Each Company record will be decorated with 
// an "orders" method which yields a store 
// containing associated orders. 
{ 
    name: 'companyId', 
    reference: { 
     type:'companyModel', 
     inverse:'orders' 
    } 
}, { 
    name: 'productCode' 
}, { 
    name: 'quantity', 
    type: 'number' 
}, { 
    name: 'date', 
    type: 'date', 
    dateFormat: 'Y-m-d' 
}, { 
    name: 'shipped', 
    type: 'boolean' 
}], 

proxy: { 
    type: 'memory', 
    data: ordersListJSONArray 
}}); 

变化小部件:

widget: { 
      xtype: 'grid', 
      autoLoad: true, 
      bind: { 
       store: '{record.orders}', 
       title: 'Orders for {record.name}' 
      }, 
      columns: [{ 
       text: 'Order Id', 
       dataIndex: 'id', 
       width: 75 
      }, { 
       text: 'Procuct code', 
       dataIndex: 'productCode', 
       width: 265 
      }, { 
       text: 'Quantity', 
       dataIndex: 'quantity', 
       width: 100, 
       align: 'right' 
      }, { 
       format: 'Y-m-d', 
       width: 120, 
       text: 'Date', 
       dataIndex: 'date' 
      }, { 
       text: 'Shipped', 
       dataIndex: 'shipped', 
       width: 75 
      }] 
     }