Search code examples
javascriptextjsextjs4rally

filter defects by dates, selected from combobox rally


Want to filter defects by three conditions Open defects, defect release start date, and defect release end date. For release start date and release end date I am selecting from date combobox.

Below is my code

            _prepareChart: function() {
                that = this;
                console.log("start date", that._startDate);
                console.log("end date", that._endDate);
                Ext.create('Rally.data.WsapiDataStore', {
                    model: 'Defect',
                    //fetch: ['Release'],
                    limit: Infinity,
                    field: 'State',
                    autoLoad: true,
                    storeConfig: {
                        filters: [
                            {
                                property: 'State',
                                operator: '=',
                                value: "Open"
                            },
                            {
                                property: 'Release.ReleaseStartDate',
                                operator: '=',
                                value: that._startDate
                            },
                            {
                                property: 'Release.ReleaseDate',
                                operator: '<=',
                                value: that._endDate                                
                            }
                        ],  
                    },      
                    listeners: {
                        load: this._onDataLoaded,
                        //load: this._onDataLoadedfirst,
                        scope: this
                    }
                }); 
            },  

Below is the application screen from where I am selecting the dates

enter image description here


Solution

  • You may use javascript toISOString method as in this example

    var today = new Date().toISOString();
       Ext.create('Rally.data.wsapi.artifact.Store', {
          models: ['UserStory','Defect'],
          fetch: ['Owner', 'FormattedID','Name','ScheduleState','Tasks'],
           autoLoad: true,
          filters : [
             {
                property: 'Iteration.StartDate',
                operator: '<=',
                value: today
              },
              {
                 property: 'Iteration.EndDate',
                 operator: '>=',
                 value: today
              }
            ],
            listeners: {
               load: this._onDataLoaded,
               scope: this
               }
    });