Closed graferowy closed 5 years ago
As far as I know the scenario you describe should work transparently. You may be hitting a local bug:
$activeState = $request->query->get('state', 0);
This would always be zero if your URL indeed is http://mypage.com/users/?active=1 as you describe (the param is a different name).
Ok, I figured it out. Datatables sends seperate POST request to load the table after the page loads, that's why I couldn't get any get parameters.
In order for me to get desired parameters I had to get them from headers referer.
$activeParam = Request::create($request->headers->get('referer'))->get('state', 0)
EDIT:
If I change config to use GET for callbacks I still need to use referer to access my get parameters. Datatables creates its own requestUri when sending request to controller ( i.e. /my/path/?_dt=dt&_init=true
) .
Hello!
Is there a possibility to pass query parameters along with datatables request? Lets say I am on mypage.com/users/?active=1 because I want to filter only active users. Datatables unfortunately sends request from mypage.com/users so my controller has no idea about my filter parameters. Is there anything I can do?
My code looks something like this:
I will be grateful for any help.