extjs5 mvvm gridpanel bind store后不显示数据

lance43640678 2016-07-14 04:26:51
================View====================
Ext.define('app.view.baseinfo.customer.CustView', {
extend : 'Ext.panel.Panel',

alias : 'widget.CustomerView',

requires : ['app.controller.baseinfo.CustController',
'app.viewmodel.baseinfo.CustViewModel'],

uses : ['app.view.baseinfo.customer.region.Grid',
'app.view.baseinfo.customer.region.WhereForm'],

referenceHolder: true,

controller : 'customer',

viewModel : {
type : 'customer'
},

title : '客户信息档案',
glyph : 0xf0f7,
closeAction: 'destroy',
layout : 'border',

initComponent : function(){
this.glyph = this.getViewModel().get('tf_glyph'); // 由于上面的glyph的bind无效,因此需要在这里加入glyph的设置
this.items = [{
xtype : 'whereform',
region : 'north'
}, {
xtype : 'custgrid', // 模块的grid显示区域
region : 'center'
}],
this.callParent(arguments);
}
});

==========================Gridpanel=============================
Ext.define('app.view.baseinfo.customer.region.Grid', {
id : 'customerGrid',
extend : 'Ext.grid.Panel',
alias : 'widget.custgrid',
uses : ['app.view.baseinfo.customer.region.GridToolbar'],

viewConfig: {
preserveScrollOnRefresh: true,
preserveScrollOnReload: true
},
//列前增加checkbox
/* selModel: {
selType: 'checkboxmodel',
checkOnly: true,
showHeaderCheckbox: true
},*/
dockedItems : [{
xtype : 'gridtoolbar', // 按钮toolbar
dock : 'top'
},{
xtype: 'pagingtoolbar',
bind: {
store: '{customerStore}'
},
dock: 'bottom',
displayInfo: true,
displayMsg: '当前 第{0}-{1} 条 / 共 {2} 条',
emptyMsg: "没有数据"
}],
bind: {
store: '{customerStore}'
},
columns: [new Ext.grid.RowNumberer(),
{header : '客户编码', width : 80, align : 'center',dataIndex : 'custno'},
{header : '客户名称', width : 120, align : 'center', dataIndex : 'custname'},
{header : '联系人', width : 60, align : 'center', dataIndex : 'linkman'},
{header : '担保人', width : 60, align : 'center', dataIndex : 'address'},
{header : '电话', width : 100, align : 'center', dataIndex : 'custtel'},
{header : '手机', width : 100, align : 'center', dataIndex : 'custphone'},
{header : '省', width : 80, align : 'center', dataIndex : 'province'},
{header : '市(辖区)', width : 80, align : 'center', dataIndex : 'city'},
{header : '县(区)', width : 80, align : 'center', dataIndex : 'county'},
{header : '街道', width : 100, align : 'center', dataIndex : 'street'},
{header : '销售顾问', width : 80, align : 'center', dataIndex : 'seller'},
{header : '介绍线人', width : 80, align : 'center', dataIndex : 'informer'},
{header : '是否线人', width : 60, align : 'center', dataIndex : 'isinfor'},
{header : '联系人电话', width : 100, align : 'center', dataIndex : 'linktel'},
{header : '联系人手机', width : 100, align : 'center', dataIndex : 'linkphone'},
{header : '信誉额度', width : 60, align : 'center', dataIndex : 'creditlimit'},
{header : '身份证号', width : 150, align : 'center', dataIndex : 'cardno'},
{header : '客户生日', width : 100, align : 'center', dataIndex : 'birthday'},
{header : '全称', width : 120, align : 'center', dataIndex : 'fullname'},
{header : '法人', width : 60, align : 'center', dataIndex : 'corporate'},
{header : '税号', width : 100, align : 'center', dataIndex : 'heading'},
{header : '开户行', width : 80, align : 'center', dataIndex : 'bank'},
{header : '开户账号', width : 80, align : 'center', dataIndex : 'account'},
{header : '开票地址', width : 120, align : 'center', dataIndex : 'invoaddress'},
{header : '备注', width : 200, align : 'center', dataIndex : 'remark'}
],
stripeRows : true, // 行分隔符
columnLines : true, // 列分隔符
loadMask : true, // 加载时的遮罩
frame : true,
listeners : {
dblclick: {
element: 'body',
fn: 'onEditCustomer'
}
}
});

============================ViewModel===============================
Ext.define('app.viewmodel.baseinfo.CustViewModel',{

extend : 'Ext.app.ViewModel',

alias : 'viewmodel.customer',

requires : ['app.model.baseinfo.Customer',
'app.model.City',
'app.store.baseinfo.Customer'],
data : {
tf_title : '客户信息档案',
tf_glyph : 0xf0f7,
custPageSize : 25
},
stores : {
customerStore : {
type : 'customerStore'
},
sellerStore : {
type : 'sellerStore '
}
}
});
...全文
372 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sinat_29510163 2016-11-25
  • 打赏
  • 举报
回复
求问楼主有没有解决,遇到了类似的问题
lance43640678 2016-07-14
  • 打赏
  • 举报
回复
哪位大神帮忙解决一下
lance43640678 2016-07-14
  • 打赏
  • 举报
回复
customerStore 在firebug中查看,已经取到值了,就是在Grid中不显示,不是字段不对应的问题

87,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧