PDA

View Full Version : Ext.ux.grid.filter.DateFilter setValue doesn't really set value



watermark
28 Dec 2012, 11:32 AM
Ext version tested:

Ext 4.1.3
Browser versions tested against:

Chrome
Description:

The setValue function only sets the check status and the picker value, not the actual field value. The field value only gets updated on check change, hence, setValue doesn't really set the value until the filter is unchecked and rechecked.
Steps to reproduce the problem:

Create a grid with a date column, create a datefilter on that column
Set the filter normally via the column menu
Set the filter value pragmatically via code below
Call getValue on the filter
The result that was expected:

The setValue call changes the value that getValue returns
The result that occurs instead:

getValue still returns what was previously set, as if setValue wasn't called
Test Case:


var filter = grid.filters.get('datecolumn');
var oldDate = filter.getValue();
var newDate = { after: new Date('[somedate]') };
filter.setValue(newDate);
var setDate = filter.getValue();

newDate != setDate

newDate == oldDate

watermark
28 Dec 2012, 11:40 AM
workaround:


Ext.ux.grid.filter.DateFilter.override({
init: function() {
this.callOverridden();
this.on('update', this.updateValues);
},


updateValues: function() {
var me = this, key, picker;
for (key in me.fields) {
if (me.fields[key].checked) {
picker = me.getPicker(key);
me.values[key] = picker.getValue();
}
}
}
});

geovanni.duarte
21 Nov 2013, 12:56 PM
Good afternoon, I'm creating a dynamic grid panel and works fine, except the DateFilters, when i want to filter at second time, show on console the following error : this.fields[item].menu is null, debugging the javascritp code i found that the menu object in the CheckItem is null after the first filter . I need help, took three days solving this error. thanks. im using sencha 4.1.0.