Login Register

filter

Filter Grid by Date Range

Hello,

I have written some code that initially displays a grid with all of rows from a table. The user then has the ability to filter the rows by one or more columns. One of the columns in the grid displays Date values. I would like to be able to filter the rows based on a date range specified by the user. Is this possible? If so, would someone show me how?

I have provided a snippet of the code that is filtering the grid below.

var filter = {};
          if (dijit.byId('filterPNumber').getValue().length > 0)
            dojo.mixin(filter, {P_NUMBER: '*' + dijit.byId('filterPNumber').getValue() + '*'});
          if (dijit.byId('filterPM').getValue().length > 0)
            dojo.mixin(filter, {PROJECT_MANAGER: dijit.byId('filterPM').getValue()});
          if (dijit.byId('filterCName').getValue().length > 0)
            dojo.mixin(filter, {CUSTOMER_NAME: '*' + dijit.byId('filterCName').getValue() + '*'});
          if (dijit.byId('filterCNumber').getValue().length > 0)
            dojo.mixin(filter, {CUSTOMER_NUMBER: '*' + dijit.byId('filterCNumber').getValue() + '*'});
          if (dijit.byId('filterPO').getValue().length > 0)
            dojo.mixin(filter, {PO_NUMBER: '*' + dijit.byId('filterPO').getValue() + '*'});
          if (dijit.byId('filterCType').getValue().length > 0)
            dojo.mixin(filter, {CUSTOMER_TYPE: dijit.byId('filterCType').getValue()});
          
          dijit.byId('propGrid').filter(filter);
          dijit.byId('propGrid')._refresh();

Thanks in advance!
Melanie

ClientFilter

Has anyone have experience with the ClientFilter (dojox.data.ClientFilter) which is used for local caching ?
As described on [url]http://docs.dojocampus.org/dojox/data/ClientFilter[/url] it is just necessary to define the ClientFilter dojo.require('dojox.data.ClientFilter'); BEFORE the required DataStore and to assign queryOptions="{cache:true}" to the appropriate DataGrid.
This is what i did so far... but that doesn't work! I think i have to somehow change the fetch()-method but I'm not sure. Has anyone experience with it and maybe an example code !?!??!

Array Functions

Along with dojo.forEach, Dojo provides other array functions which mimic JavaScript 1.6 functionality. And that's good news for IE users, who don't have the luxury of JavaScript 1.6 yet.

Syndicate content