This is something I have never got this right. Let me start from the beginning: We use listgrid to filter only on the server side, so no client side filtering, and filter button is hidden and FilterEditorSubmitHandler is set to event.cancel();
so User really cannot do anything until clicks custom filter button in the page. We do on the server side get data and provide to the gird, gird only needs to show them. No fetch data, no client side criteria is set. So no client side filter is used in this case due to requirement.
so We do query against Criteria criteria = grid.getFilterEditorCriteria(); criteria, since user does not click filter button, grid.getCriteria() is null or empty and does not reflect user input. I implemented some ugly hack to read input data from grid.getFilterEditorCriteria();
All it is good so far.
When user selects date from filter, I get following:
So date is in this format: MM/dd/yyyy HH:mm
when user clicks custom filter button I go to server get the data and do following: grid.fetchData(grid.getFilterEditorCriteria());
So grid.getCriteria() and grid.getFilterEditorCriteria()' matches to each other. But when I do so, it messes up the date and it ends up being like this:
I tried all possible ways to correct this format without luck.
No luck.
is there any way to control format of the date filter and how to add date filter in the criteria so when apply this grid.getFilterEditorCriteria() to criteria it won't mess up input.
this is how started field defined in datasource:
I really need a help on this.
Thanks in advance.
so User really cannot do anything until clicks custom filter button in the page. We do on the server side get data and provide to the gird, gird only needs to show them. No fetch data, no client side criteria is set. So no client side filter is used in this case due to requirement.
so We do query against Criteria criteria = grid.getFilterEditorCriteria(); criteria, since user does not click filter button, grid.getCriteria() is null or empty and does not reflect user input. I implemented some ugly hack to read input data from grid.getFilterEditorCriteria();
All it is good so far.
When user selects date from filter, I get following:
So date is in this format: MM/dd/yyyy HH:mm
when user clicks custom filter button I go to server get the data and do following: grid.fetchData(grid.getFilterEditorCriteria());
So grid.getCriteria() and grid.getFilterEditorCriteria()' matches to each other. But when I do so, it messes up the date and it ends up being like this:
I tried all possible ways to correct this format without luck.
Code:
one of the try : grid.getFilterEditorCriteria().addCriteria("started", DateTimeFormat.getFormat("MM/dd/yyyy HH:mm").format(new Date(longValue)))); other one: grid.getFilterEditorCriteria().addCriteria("started", new Date(longValue)));
is there any way to control format of the date filter and how to add date filter in the criteria so when apply this grid.getFilterEditorCriteria() to criteria it won't mess up input.
this is how started field defined in datasource:
Code:
DataSourceDateTimeField STARTED = new DataSourceDateTimeField("started"); STARTED.setDateFormatter(DateDisplayFormat.TOUSSHORTDATETIME);
I really need a help on this.
Thanks in advance.
Comment