dGrid/dStore filter question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

dGrid/dStore filter question

Rob Gillan-2
Hi all,

When we previously used dGrid with dojo/store we were able to set the query on the store as part of the grid.  We have a filter panel that the user can select things like dates to display, and previously we used code like this:

                                filterCommunity = function () {
                                        field1 = registry.byId('cm_community_forms').get('checked');
                                        field2 = registry.byId('cm_community_activities').get('checked');
                                        storeQuery = function (item) {
                                                var startTime, endTime, itemDate, fromDate, toDate;
                                                if (field1 === true && item.type === 'form') {return1 = true;} else {return1 = false;}
                                                if (field2 === true && item.type === 'activity') {return2 = true;} else {return2 = false;}
                                                return (return1 || return2)
                                        };
                                        cm.communityGrid.set('query', storeQuery);
                                        cm.communityGrid.refresh();
                                };

dStore now has a filter rather than a query.  We use the same store as the base data for a number of things (a grid, some charts etc.) so it was good that the filter/query was associated with the dGrid accessing the store, rather than filtering the store itself.

I’m obviously missing something but is there anything similar when using dGrid with dStore?

Cheers
Rob
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: dGrid/dStore filter question

Rob Gillan-2
I’ve found that this approach works:


        var filter = new sp1.settlementStore.Filter();
        storeFilter = filter.eq('stStatus', 2);
        filteredData = sp1.settlementStore.filter(storeFilter);
        sp1.settlementGrid.set('collection', filteredData);

all good ;)

> On 2 Mar 2016, at 8:29 am, Rob Gillan <[hidden email]> wrote:
>
> Hi all,
>
> When we previously used dGrid with dojo/store we were able to set the query on the store as part of the grid.  We have a filter panel that the user can select things like dates to display, and previously we used code like this:
>
> filterCommunity = function () {
> field1 = registry.byId('cm_community_forms').get('checked');
> field2 = registry.byId('cm_community_activities').get('checked');
> storeQuery = function (item) {
> var startTime, endTime, itemDate, fromDate, toDate;
> if (field1 === true && item.type === 'form') {return1 = true;} else {return1 = false;}
> if (field2 === true && item.type === 'activity') {return2 = true;} else {return2 = false;}
> return (return1 || return2)
> };
> cm.communityGrid.set('query', storeQuery);
> cm.communityGrid.refresh();
> };
>
> dStore now has a filter rather than a query.  We use the same store as the base data for a number of things (a grid, some charts etc.) so it was good that the filter/query was associated with the dGrid accessing the store, rather than filtering the store itself.
>
> I’m obviously missing something but is there anything similar when using dGrid with dStore?
>
> Cheers
> Rob
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
>
> [hidden email]
> To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest