PDA

View Full Version : [OPEN-1347] [3.x] DateFilter menuItems cfg option is broken



spcjak7221
19 Oct 2010, 11:45 AM
Ext version tested:

Ext 3.0.0

Adapter used:

ext

css used:

default ext-all.css

Browser versions tested against:

IE8
FF3 (firebug 1.3.0.10 installed)

Operating System:

WinXP Pro

Description:

The DateFilter class has a parameter called menuItems that allows the selection of which items appear in the menu. If one just wants to allow the selection of a date and not use "Before" and "After" they can pass just 'on'. A javascript error is thrown when attempting to use it because it attempts to uncheck the non-existent "Before" and "After" fields when the "On" field is selected.

Test Case:
filters = new Ext.ux.grid.GridFilters({
encode: false,
local: false,
filters: [{
type: 'date',
dataIndex: 'review_date',
menuItems: ['on']
}]
});


See this URL : http://

Steps to reproduce the problem:

Create a DateFilter on a grid as described above. Attempt to select a date using the filter.

The result that was expected:

no javascript exception

The result that occurs instead:

javascript exception

Screenshot or Video:

none

Debugging already done:

none

Possible fix:

Modify examples\us\gridfilters\filter\DateFilter.js onMenuSelect function as follows:


var fields = this.fields,
field = this.fields[menuItem.itemId];

field.setChecked(true);

if (field == fields.on) {
/*start edit*/if(fields.before!=null)/*end edit*/fields.before.setChecked(false, true);
/*start edit*/if(fields.after!=null)/*end edit*/fields.after.setChecked(false, true);
} else {
fields.on.setChecked(false, true);
if (field == fields.after && fields.before.menu.picker.value < value) {
fields.before.setChecked(false, true);
} else if (field == fields.before && fields.after.menu.picker.value > value) {
fields.after.setChecked(false, true);
}
}
this.fireEvent('update', this);

meroy
19 Oct 2010, 12:44 PM
Thanks for the finding.