由buffered:true引致Grid统计出错

  上星期五,在写一个Grid,里面有一个金额的字段需要进行统计,代码如下:

Ext.define('book',{
		extend:	'Ext.data.Model',
		fields: [
		    {name: 'bookname'},         
		    {name: 'bookprice'},
		    {name: 'author'}

	    ]
	});
   	var bookstore = Ext.create('Ext.data.Store',{
		model: 'book',
		autoLoad:	true,
		buffered:   true,
		proxy:		{
			type:		'ajax',
			url:		'books.json',
			reader:		{
				type:	'json',
				root:	'bookList'
			}
		}
	});

.................
................
			    {
			    	xtype:			'grid',
			    	store:			bookstore,
			        title: 			'books',
					columnLines: 	true,
			        frame:			false,
			        padding: 		'5 5 5 5',
			        enableColumnHide :false,
					selType:		'rowmodel',
			        height: 		 500,
			        width:          '100%',
			        plugins:		'bufferedrenderer', 
			        features: [
			           {ftype: 	'summary'}
			        ],
					//dockedItems:[pageInfo],
					viewConfig:	{
						forceFit:	true,
						stripeRows:	true,
						scrollDelta:	160
					},
			        columns: [
				        Ext.create('Ext.grid.RowNumberer',{text: 'No', width: 52}),	
				        
			            { text: '书名',  dataIndex: 'bookname',width: 400, sortable: false },
			            { text: '金额', dataIndex: 'bookprice',align: 'right', xtype: 'numbercolumn', format: '0,000.00', width: 130, sortable: false, 
			            	summaryType: 'sum',
			            	summaryRenderer: function(value){
  		            		    Ext.util.Format.thousandSeparator= ',';
  		            		    Ext.util.Format.decimalSeparator='.';
  		            			return  '合计:'+Ext.util.Format.number(value, '0,000.00')	
			            	}
			            },
			            { text: '作者',  dataIndex: 'author',width: 130, sortable: false },
			            
.....................
.....................

 

books.json内容如下:

bookList:[
   {bookname: 'java从入门到精通', bookprice: 56.40},
   {bookname: 'java Web编程', bookprice: 72.30},
   {bookname: 'Python Web编程', bookprice: 32.30},
   {bookname: 'Javascript高级程序设计', bookprice: 93.20}
]}

以上代码,运行时却显示不出结果,出错信息如下图:



后来将store的buffered:true,改成false,或删除,则运行正常。

如何使用buffered, 请参看 http://blog.csdn.net/wilsonyun/article/details/46513881




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值