jQWidgets Forums

jQuery UI Widgets Forums Grid Possible bug discovered in initial filters

This topic contains 3 replies, has 2 voices, and was last updated by  wavetrex 10 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Possible bug discovered in initial filters #67228

    wavetrex
    Participant

    Hi !
    I am encountering a javascript error inside jqxgrid.js related to the INITIAL FILTERS (the new feature introduced in 3.6.0).

    It only happens when setting filters for a “RANGE” date column ( two filters on the same group, one being LESS_THAN_OR_EQUAL and the other GREATER_THAN_OR_EQUAL, applied to a date column ).

    The filters result from exporting during the event “filter”:

    
    	exportfilters = [];
    	for(var c=0;c<event.args.filters.length;c++) {
    		exportfilters.push({
    			column: event.args.filters[c].datafield,
    			filters: event.args.filters[c].filter.getfilters()
    		});
    	}
    

    … this then gets saved in the database etc. and later reused with something like this:

    
    	var filterdata = null, jqxfilter = null, fd = null, c2;
    	for(c=0; c<self.config.grid_state.filters.length; c++) {
    		filterdata = self.config.grid_state.filters[c];
    		if(!gridColumnsIndex[filterdata.column])
    			continue; // Column not found, skip
    
    		// Create the jqxFilter (may have multiple filters in it - checkboxes for example)
    		jqxfilter = new $.jqx.filter();
    		for(c2=0; c2< filterdata.filters.length; c2++) {
    			fd = filterdata.filters[c2];
    			jqxfilter.addfilter(fd.operator, jqxfilter.createfilter(fd.type, fd.value, fd.condition));
    		}
    
    		// ... and apply it to the proper column
    		gridColumns[gridColumnsIndex[filterdata.column]].filter = jqxfilter;
    	}
    

    Note: gricColumns is defined earlier (is an array of objects) and is basically the parameter that goes to jqxGrid initialization:

    columns: gridColumns

    Please know, this WORKS for everything I tested so far ( text filter, number filter, dropdown (with or without checkboxes), simple date (not a range), boolean filter.
    Even checkbox filters which have multiple “EQUAL” values work.

    The problem only occurs for DATE “RANGE” filter.

    Thank you in advance for checking,
    Wave

    Possible bug discovered in initial filters #67229

    wavetrex
    Participant

    I forgot to mention:

    – jqx Version 3.6.0
    – The error occurs on line 11974 of the source code:

    
     if (column.cellsformat) {
    

    Apparently “column” is null. The value above “filters[m].datafield” contains the correct column identifier ( datafield ), and the column exists in the grid.

    Possible bug discovered in initial filters #67230

    Peter Stoev
    Keymaster

    Hi wavetrex,

    If you would like to report a bug, then provide a full sample which illustrates it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Possible bug discovered in initial filters #67233

    wavetrex
    Participant

    Thank you for the answer Peter.

    Unfortunately, a full sample might be complicated… the software I’m working on is very complex and extracting the “sample” out of context would not make much sense. And the entire code file managing the grid is over 1500 lines long.

    I will try however to write an independent code illustrating this issue and paste it here. Will come back with it once the test code is ready.
    Wave

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.