I am working with a PERL Miner::Base and JavaScript platform (.pm and .js).
My JavaScript contains 3 ExtJS GridPanels.
Now, here’s my problem:
I have a function that takes ~1 minute to run and returns a list with references to the data needed for all 3 grids. Let’s call this function “foo”.
Currently, in order to load each of my grids’ store, I call a function that calls “foo” and returns only the relevant reference out of the list returned by “foo”.
I need a way to call “foo” only once and share the data it returns between my 3 stores.
Is there such a way?
Thanks.
Here is the basic structure of my code:
my_code.js:
gridA with storeA (calls my_code.pm::get_A_data)
gridB with storeB (calls my_code.pm::get_B_data)
gridC with storeC (calls my_code.pm::get_C_data)
my_code.pm:
get_A_data (calls foo and returns the first reference returned from foo)
get_B_data (calls foo and returns the second reference returned from foo)
get_C_data (calls foo and returns the third reference returned from foo)
If you have three grids you effectively would need to have three stores. However you can do one request, get a store object and then clone it into other two local copies. Search for
cloning ExtJs store