Hi jgarcia!
Here is a GridPanel instance which I believe it works:
PHP Code:
var searchData = [["t1","s1"],["t2","s2"],["t3","s3"]];
var SearchResultsGridPanel = new Ext.grid.GridPanel({
store: new Ext.data.SimpleStore({
fields: [
{name: 'title'},
{name: 'summary'},
],
data: searchData
}),
columns: [
{id:'title', header: "Title", dataIndex: 'title'},
{header: "Summary", dataIndex: 'summary'}
],
title: "Search Results",
sm: new Ext.grid.RowSelectionModel({singleSelect:true})
});
I could write a conversion function to create the searchData array from a SearchResults instance. However, this conversion requires duplication of data which is already in memory. Hence I am looking for a performance effective approach.
I still do not understand what the Store is doing with the data. It seems that the data is duplicated into some other object structure inside the Store... If so, then adding another conversion makes it even slower. After reading few dozens of post about Stores, Readers & Co., it seems to me that a better approach could be to provide a custom Reader, say SearchResultsReader, this way only the conversion required by the Store will be done.
Any insights? Advices?
Adrian.