myMixedCollection
sarà una raccolta di record (istanze di modello) e fintanto che il nuovo negozio avrà lo stesso modello impostato, questo funzionerà! Quindi la risposta è Sì
Beh, di sicuro è necessario chiamare getRange() sul myMixedCollection
istanza
Ecco un esempio di lavoro
// Set up a model to use in our Store
Ext.define('Simpson', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'email', type: 'string'},
{name: 'phone', type: 'string'}
]
});
var s1 = Ext.create('Ext.data.Store', {
model:'Simpson',
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"[email protected]", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
var mixed = s1.queryBy(function(rec){
if(rec.data.name == 'Lisa')
return true;
});
var s1 = Ext.create('Ext.data.Store', {
model:'Simpson',
storeId:'simpsonsStore2',
fields:['name', 'email', 'phone'],
data: mixed.getRange(),
proxy: {
type: 'memory',
reader: {
type: 'json'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore2'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
e la JSFiddle
E possa la downvoter si prega di indicare il motivo per cui ha downvoted? – sra
Sì, funziona, ho dimenticato di usare il metodo getRange(). Thx sra. – dgedge03
i troll sono fuori :) – dbrin