Plug-in example for options?
Plug-in example for options?
I've made a couple of plug-ins for the api, but is there an example of a plug-in to add options?
I have several tables that are "static" in the sense that I want to show the table without the user having the ability to interact with the table.
For those tables I end up repeating this since the defaults for these are true:
{
....
info: false,
ordering: false,
paging: false,
searching: false,
....
}
It would be nice if I could simply enter this:
{
....
static: true,
....
}
and then have DataTables set info
, ordering
, paging
, and searching
to false before the table is initialized.
Is there anything I could be pointed to that would help me start?
This question has an accepted answers - jump to answer
Answers
Sounds like you want to set default options.
Kevin
Thanks, Kevin (@kthorngren), that's one option, but I only want to make about a third of my tables "static" so I'd be back to the same issue of setting those options for the other tables.
I'm sure there's a way to approach it the way I'm thinking, but I just don't see an example.
You could combine two configuration objects together, something like this:
https://live.datatables.net/kotudavi/1/edit
Or you can do something like this;
https://live.datatables.net/qukogezu/1/edit
Its more a. Javascript exercise than Datatables. You just need to find your favorite way to combine two Javascript objects.
Kevin
Oooh -- I like that second option!
I was trying something like that before but was leaving out the
...
part and it obviously wouldn't work!As always, thanks Kevin!