Accessing DataTables object from field type plugin
Accessing DataTables object from field type plugin
jkiel
Posts: 3Questions: 2Answers: 0
After reading:
https://editor.datatables.net/manual/development/field-types
I can't find a way to easily access the datatables table object so I can do things like table.rows("#myid"), etc., from within the field plugin. How is this done?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
There isn't a way to do that since the field types need to work with or without DataTables.
What is your end goal?
Allan
My goal is to allow available options in a field plugin be filtered based on current row data in the table without having to issue another server request to get the same data already in the table.
Can that list of options be derived from the host DataTable? Normally it would require an Ajax call since the DataTable might not currently use all options that are available. Although if it is a "self join" field then I can see how that would work.
What I would suggest is to use a
select
field and theopen
event method to update its options available (the select field type has afield().update()
method for that).That was you keep all of your code that is related to a single table in one place rather than needing to split it into a plug-in that wouldn't be particularly generic.
Allan