What is the way to copy data from LABKEY.ext.Store to a regular Ext.data.ArrayStore ?

LabKey Support Forum (Inactive)
What is the way to copy data from LABKEY.ext.Store to a regular Ext.data.ArrayStore ? Leo Dashevskiy  2012-05-21 14:56
Status: Closed
 
The former is good for retrieving (static) data from Labkey's db, but is not flexible enough (since it's query-based) for real-time on-the-fly data manipulation: filtering and sorting, that's why I would like to utilize the latter for these purposes.

Thanks.
 
 
Ben Bimber responded:  2012-05-21 15:12
hi leo,

it sounds like what you're really talking about is whether the filtering/sorting is performed on the client or the server. once the LabKey store has initially loaded, it's basically the same thing as the ArrayStore. You could create a LABKEY store and either:

1) i'm pretty sure if you just call store.filter('myField', 'value') it will perform that on the client. this isnt what you'd want 100% of the time, but perhaps some of the time. If you need to replicate more complex filters, like startswith, contains, etc then you'd just use a regex for filtering (ie. /^foo/i).

2) if you set the store's properties remoteFilter and remoteSort to false, it should sort client-side. i'm less certain how everything will behave without doing some testing, and could look into that if you like.

when we convert our API to Ext4 I'd love to see cleaner ways to handle manipulation of the store, but I think what you need is quite possible in the Ext3 store too.
 
Leo Dashevskiy responded:  2012-05-21 15:47
Ok, Ben, good to know this.
So remoteSort (at least in the Ext's store) is defaulted to false, not sure about Labkey's (it does not seem to be mentioned anywhere otherwise) and I do not even see the remoteFilter config option anywhere :( (Neither Ext, nor Labkey docs...)

Well, the sorting bug I was having seemed to have disappeared (on its own?) even without specifying these two config options you mentioned - last week it was misbehaving... Either I am seeing such "ghosts" for the second time now or I'm going delirious (or might be some kind of caching may be...)
 
Leo Dashevskiy responded:  2012-05-21 16:54
Must be caching, I swear ;)

After I removed the remoteSort config it was working for me for a little bit until recently (I thought the default is false), now looked up in the code and the default is true, no wonder, it was acting all crazy.


So some more questions about the LABKEY.ext.Store and whether it will suit my needs:
I have a need to extend the LovComboBox that has a Labkey store as the data source to include a "Select All" option, which I found an implementation of. It inserts an extra item into the store at the very beginning with this custom behavior. The question is: does Labkey store allow "local only insertion"? I mean, I absolutely do not need to modify the db data on the server.

Thanks.
 
Ben Bimber responded:  2012-05-21 18:40
it will not save anything unless you call commitChanges() on your store. all changes are client-side only.
 
Leo Dashevskiy responded:  2012-05-22 10:09
Got ya, that's good.