Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong data when the filter must returns 0 rows #387

Open
VMitin opened this issue Jan 2, 2017 · 0 comments
Open

Wrong data when the filter must returns 0 rows #387

VMitin opened this issue Jan 2, 2017 · 0 comments

Comments

@VMitin
Copy link

VMitin commented Jan 2, 2017

Hi.

I'm using the org.got5.tapestry5.jquery.components.DataTable for showing my data as a table.
I'm using the mode parameter as true. My tml block:
<t:datatable t:id="datatable"
id="datatable"
t:type="grid"
..........
t:mode="true"
..........
class="table table-hover">

If the user has filled in the search filter with some query and has returned 0 rows, the previously rendered rows was not deleted.

I start the debug this situation and found next:
In the DefaultDataTableModel in the public method getResponse(GridDataSource source) has checked on count of the records.
if (records == 0){
......
response.put("aaData", rows);
return response;
}

Why rows and not the new JSONArray()? Ok I looking next and see that rows re-initialized with the previous request
* Re-initialize the JSONArray for the next ajax request
* */
rows = new JSONArray();

But the problem with next. You add the PartialMarkupRendererFilter for the rendering the table cells and using the rows field. The rows field is filled in the method addPartialMarkupRendererFilter after the re-initialize rows!

Please change this line
response.put("aaData", rows);
on the
response.put("aaData", new JSONArray());

Or add the checking rows field
if (rows.length() != 0) {
rows = new JSONArray();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant