jQWidgets Forums

jQuery UI Widgets Forums Grid Grid – change filter value

This topic contains 2 replies, has 2 voices, and was last updated by  sinch 11 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Grid – change filter value #54672

    sinch
    Participant

    Hello,

    I have a date column in a grid, that I want to filter, but I would need to change the filter value before the grid sends it to the server, namely, to reformat from dd.mm.yyyy to a MySQL format and set it back to the filter, so that this new value is sent instead of what the user writes into the filter. Is there any way to do this without creating new filters from code and interfering with the other column filters (like simply just change the value in the current filter)? I can extract the filter value, but I can’t find anything to change it in the filter to the new value. I console.loged the filter and it seems to have a setfilterat, but I don’t find it anywhere documented … any solutions?

    So far a got this far:

    jQuery(gridid).bind('filter', function (event)
    		{
    			var filterinfo = jQuery(this).jqxGrid('getfilterinformation');
    			
    			for (i = 0; i < filterinfo.length; i++)
    			{
    				if(filterinfo[i].filtercolumn == 'date')
    				{
    					var filter = filterinfo[i].filter.getfilters();
    					console.log(filter);
    					console.log(filterinfo[i]);
    					filter.value = '2014-05-20';
    					// it has filterinfo[i].filter.setfilterat( ??? )
    					break;
    				}
    			}
    			console.log('dome');
    		});
    

    Thanks.

    Grid – change filter value #54673

    ivan
    Participant

    Hi sinch,

    You can use the formatData function of jqxDataAdapter to update the data sent to your server. Please, check this out: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-extra-http-variables.htm

    Best Regards,
    Ivan

    jQWidgets Team
    http://www.jqwidgets.com

    Grid – change filter value #54675

    sinch
    Participant

    Thanks ivan, it’s working with this solution.

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

You must be logged in to reply to this topic.