-
28 Dec 2012 11:32 AM #1
Ext.ux.grid.filter.DateFilter setValue doesn't really set value
Ext.ux.grid.filter.DateFilter setValue doesn't really set value
Ext version tested:
- Ext 4.1.3
- Chrome
- 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.
- 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 setValue call changes the value that getValue returns
- getValue still returns what was previously set, as if setValue wasn't called
Code: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
-
28 Dec 2012 11:40 AM #2
workaround:
Code: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(); } } } });
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote