javascript - dstore filter date range -


i have data array has date attribute, need filter data based on date.

i using dstorejs store data below

this.employeestore = new memory({data:[emplist],idproperty:"emp_num"}); 

i need make filter based on employee's joining date , joined 1st of jan 2014 till 3rd of march 2015

this.employeestore.filter({joindate:'01/01/2014'}); 

this gives employees joined on 1st of jan 2014 if need filter in range

this.employeestore.filter.gte({joindate:'01/01/2014'}); 

this not work because not number, string or date object

to achieve need write custom store mentioned in tutorial?

is there other way of doing this?

or there other framework dstore achieve ?

you can achieve using dojo/store query filter , query callback function manage comparing date

and using dojo/date compare function compare date of emplist array specific date below :

this.employeestore = new memory({data: somedata});  var comparedate = new date(2014,1,1);  var results = store.query(function(object){     // compare return -1 if lower      // return 0 if equals     // return 1 if greater     return date.compare(object.date, comparedate) > -1; });  results.foreach(function(yourresultdata){     // stuff looping results }); 

you can see fiddle have better understanding .


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -