EXTJS 两个store 一个负责显示,一个负责装载数据

本文探讨EXTJS中如何使用两个不同的store,一个用于数据加载,另一个用于数据显示。通过详细步骤,解释了如何从装载数据的store遍历并重新封装数据,将其传递给dataview所绑定的展示store。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

dataview指定展示的store

	var jesLogSqlStore4View = Ext.create('Ext.data.Store', {
		fields : ['SQL','ExecuteCount','MaxTimespan'],
		data : 'params'
	});
	
	
	xtype:'dataview',
		name:'sqlList',
		autoScroll:true,
		itemTpl:sqlTpl,
		store: jesLogSqlStore4View
	}

装载数据的store

var jesLogSqlStore4Ajax = Ext.create('Ext.data.Store',{
		fields:['SQL','ExecuteCount','MaxTimespan'],
		autoLoad : true,
		proxy : {
			type: 'ajax',
			url : 'druid/sql.json?orderBy=SQL&orderType=desc&page=1&perPageCount=1000000&'
			, reader : {
				type: 'json'
				, root: 'Content'
			}
		}
	});

两个store交互

将装载数据的store拿出来,遍历,重新封装,传给负责展示的store

function complateData(){
        var params = [];
        jesLogSqlStore4Ajax.each(function (record) {
            var result = {
                SQL: record.get("SQL"),
                ExecuteCount: record.get("ExecuteCount"),
                MaxTimespan: record.get("MaxTimespan")
            };
            params.push(result);
        });
        jesLogSqlStore4View.loadData(params);

    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值