Skip to content

Struts2 JQuery Plugin 4.0.3 - Grid with search/filter issue #178

Description

@nitinperi

Issue: Grid not retaining the filter criteria applied once it loses the focus if a popup window is open and when the focus come back after user operation. Please see the scenario below.

• User open a page with a list of employee grid on it. User wait till the grid is done loading first time and displaying all the results (100 rows) which are pulled from database.
• User click the Find/Search feature of the grid to Filter/Find particular row/rows based on the Filter criteria for e.g. First Name as ‘John’
• After applying the search criteria, Grid displays 30 rows back with employee whose first name is John.
• User click on the first row and open another popup window where the whole record of John is listed and update the last name.
• User Save the row which also closes the popup window where last name was change and focus goes back to grid.
• The grid reload again but it loose the filter results (first name as John) and bring the whole 100 rows that it brought during the first load.
• This causes user problem as they have to re-apply the filter every time they make a change and save a record and go back to grid.
• User expect the grid to retain the filters unless until the reset is clicked on the grid or the user move out of the page and come back.

We have the following code onCompleteTopic to achieve it. But issue is the event is getting triggered multiple time than what it should be.
$.subscribe('onGridloadComplete_topicname',
function(event, data) {
var parentGrid = data['id'];
var gridVar = $("#" + parentGrid);
var postfilt = gridVar.jqGrid('getGridParam',
'postData').filters;

						if (postfilt != undefined
								&& gridVar.jqGrid("getGridParam",
										"datatype") === "json") {											
							setTimeout(function() {
								
								gridVar.trigger("reloadGrid");
							}, 5);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions