Hi i have a grid and i have two stores and i want to display both the store data in the same grid is there a way to do it...help please
Asked
Active
Viewed 3,170 times
1
-
dou you mean you have 2 store with same structure ?? it's a waste thing. assuming U use Extjs 3.*.* take look at this : http://stackoverflow.com/questions/3405437/how-to-add-records-in-json-store. this show you how to add new record.. – Egy Mohammad Erdin Apr 20 '11 at 10:13
-
Definitely curious why you are using two stores. – Keylan Apr 20 '11 at 16:54
3 Answers
0
For example, the first data col comes from Store 1 and the data from Store 2 forms cols 2 and 3. You can use a renderer that finds the data in the second store if the 'other' columns are just 'lookup' data, e.g.:
var store1 = new Ext.data.Store({
...,
fields: ['field1', 'field2']
});
var store2 = new Ext.data.Store({
...
id: 'field2',
fields: ['field2', 'fieldA', 'fieldB']
});
var renderA = function(value) {
var rec = store2.getById(value);
return rec ? rec.get('fieldA') : '';
}
var renderB = function(value) {
var rec = store2.getById(value);
return rec ? rec.get('fieldB') : '';
}
var columns = [
{header: 'Field 1', dataIndex: 'field1'},
{header: 'Field A', dataIndex: 'field2', renderer: renderA},
{header: 'Field B', dataIndex: 'field2', renderer: renderB}
];

scebotari66
- 3,395
- 2
- 27
- 34
0
The more renderers you use, the slower things will render as it's doing quite a lot, think how many renderers you have then.... 10 columns, 100 rows... 10 X 100 = 1,000 renderers.
Think how to fix your problem then to deal with what you have.

Mitchell Simoens
- 2,516
- 2
- 20
- 29