send filters to another grid in the same page

Questionssend filters to another grid in the same page
Massimo Gagliardi asked 6 years ago

Hi Abu-
I have to pass the filters of a grid to another grid in the same page.
I use this code, in the event 'js_on_load_complete' the first grid:

var grid = $("#list1");
$(grid).resetSelection();
fltrs = $(grid).getGridParam("postData").filters;
if (fltrs!==undefined && fltrs!="" {
setTimeout(function () {
cgrid = $("#list2");
p = cgrid.jqGrid("getGridParam");
cgrid[0].p.search = true;
cgrid[0].p.postData.filters = fltrs;
cgrid.triggerHandler("reloadGrid");
});
}

and it works well.

But I would like that the second grid can set other filters and that these added filters can be passed to the first grid.
But if I copy the above code in the event 'js_on_load_complete' of the second grid the script enters a loop.
Suggestions?
Thanks in advance
Massimo Gagliardi

2 Answers
Abu Ghufran answered 6 years ago

When calling this code from second grid, you can set some kind of global JS variable, e.g. var flag = 1;
and put whole code of first grid inside (!flag==1){ … }

Massimo answered 6 years ago

I done how your suggestion.
All ok.
Tks

Your Answer

2 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?