https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40013

--- Comment #13 from HKS3 Tadeusz Sośnierz <tade...@sosnierz.com> ---
> Did you try to pass functions to additional_filters?

There is no such parameter, but there is a default_filters that later gets
assigned to a (local) additional_filters – but that only gets used when
building the DBIC query (here:
https://gitlab.com/koha-community/Koha/-/blob/main/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js?ref_type=heads#L318),
not doing the postprocessing of the HTTP response, which is what I'm after.

My goal is to sneak my way into dataFilter (here:
https://gitlab.com/koha-community/Koha/-/blob/main/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js?ref_type=heads#L92)
which is currently not exposed in kohaTable.

Part of the underlying issue, in my opinion, is that kohaTable limits the
underlying dataTable rather than extending it. Its `ajax`, for instance, forces
a default behaviour on top of user preferences rather than just providing
sensible (but extensible) defaults: see the order of arguments in
https://gitlab.com/koha-community/Koha/-/blob/main/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js?ref_type=heads#L609
– the default implementation "wins". A kohaTable user cannot provide their own
implementation of dataFilter (or data, or beforeSend...), since
_dt_default_ajax() always has the last word.

Every potential dataTable usage that might be needed in the future (like the
ones in this issue) therefore requires additional APIs to be built to expose
the functionality that dataTables already provides – and the fact that we have
*two* independent kohaTables (opac and intranet) makes this even worse.

In (my) ideal world, kohaTable would be a subclass of the dataTable rather than
a (leaky) abstraction on top of it – and LSP would then ensure that I have
everything I might need :)

Some of the customer code I've written before has used dataTables directly (and
copying code from kohaTable) for this exact reason – bending and twisting
kohaTables just wasn't worth it (this is why my initial patch for
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39600 used dataTables
instead of kohaTable). In fancy terms,

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to