Closed rush4u closed 4 years ago
I suspect we may not have tested that scenario all too well and you might just be stumbling into a real bug there 😄
Alternatively we may just have consciously not implemented it as a "simple" search on DateTime does not make much sense, it would need to support ranges. To select those you'll likely need to integrate with third party date pickers. It would likely be easier to implement a customized app specific filter than try to solve this inside the bundle.
Hey man, what do you recommend me to do in this situation? This bundle solves many problems to me, but the datetime search is very important for my use case. Any alternatives?
We didn't implement this on purpose. What does is mean when you're searching for 19. Do you want all years that contain 19 or all years that start with 19 or both. That is why you need to adapt your own query, use the 2nd parameter of the query parameter like this:
"query" => function(QueryBuilder $builder, DataTableState $state){
$search = $state->getGlobalSearch();
$builder
->from("App:CarFuelFillRecord", "cffr")
->select("cffr, car, brand")
->leftJoin("cffr.car", "car")
->leftJoin("car.brand", "brand")
;
},
and adapt your query
This is the code of my action:
This is the code of my template
$(function() { $('#carFuelFillRecords').initDataTables({{ datatable_settings(datatable) }},{searching: true}); });
The datatable renders well, and it let me search by all the fields except by the only DateTimeColumn field.What am i doing wrong? Thanks a lot in advance