Closed souhaiebtar closed 1 year ago
Did you ever fix this?
Doesn't seem like it has anything to do with the bundle, must be something at PHP level or a far fetched issue with http-foundation
, but it's definitely interesting.
i believe this is because of using GET request and query parameters, author probably did not mention the internal datatable POST request that is being invoked is not using these query parameters. I have same issue.
basic url: http://localhost:8081/user-management/ 1] there is form on a page for main filtering (to display users from group 1, 2, ..) - with every change of this form, page is refreshed by GET, e.g. when i select group 3, page is refreshed and url is http://localhost:8081/user-management/?x=3 2] below this form is DataTable which has a context of the form above - I need this table shows only users from selected group - this means I need the internal datatable POST request to be http://localhost:8081/user-management/?x=3 instead of http://localhost:8081/user-management/
is there any way to do this? This question has been raised multiple times here but never answered.
Thx
is there any way to do this? This question has been raised multiple times here but never answered.
I have same issue, anybody found an answer?
Stale issue message
Hi anyone have information about this feature ? Or fix ?
@souhaiebtar @kapcus ?
I have same issue, anybody found an solution?
I think the core issue here is a misunderstanding about how the bundle works, which is entirely up to how DataTables works.
The code to create the adapter is executed (at least) TWICE for every table pageview. Once during the page generation, where the adapters are not even invoked but the definition of the table is used to inject into the page. Then after the page is loaded DataTables performs a callback to the exact same URL (and any time you change page, filters, sorting etc.). The if ($table->isCallback())
line differentiates between these 2 types of requests.
Now this means that if you open the URL /users/list?name=foo
on your site, the name
parameter is present during the initial rendering only. DataTables nor our scripts magically include the same parameters in subsequent callbacks. You have to provide some custom code to inject data in the callback. This is done through the preXhr.dt
event and is completely handled by DataTables itself. This bundle has no 'opinions' on such matters and just streamlines the integration, so there's nothing broken on this end. It's just not facilitated out of the box, nor was it ever intended to be, as there is no generic-fix-all solution that will fit every use case. For example if you have custom filters on a table page you'll want to serialize the form and inject it, a wholly different bit of code.
I'm closing this per the explanation above.
my code is
$eventId can be used in
$event = $this->em->getRepository(Event::class)->find($eventId)
and result is returned but inside anonymous function it's not passed, if i add $eventId = 2; before$table = $dataTableFactory->create()
, it work just finebut variable from
$request->request->get(
can't be usedi can't understand why? and is there an alternative?