Row Length Menu
Row Length Menu
in Editor
Does Datatables Editor edition have option for changing the number of rows in an editable datatable? Specifically something like lengthMenu: [10, 25, 50, -1] does not seem to exist.
Answers
The
datatabledocs show a config property that can be used to set the Datatable options likelengthMenu.Kevin
Interestingly I've ready your question a little differently from Kevin - I'm wondering if you want to have a length menu in a Editor based table (where the length menu is replaced by the Buttons in many cases). If so, have a look at this FAQ.
What to remember here is that Editor is an addon to DataTables. You can configure the DataTable as normal, and Editor is effectively a layer on top of that.
Apologies if I've misunderstood as you are talking about the
datatablefield type.Allan
Hi Allan and Kevin,
what I mean is this - Let's take this as an example code
new DataTable('#myTable', {
lengthMenu: [10, 25, 50, 75, 100]
});
In regular datatables this would give a drop-down that says Show [10, 25, 50, 75, 100] entries.
However when creating a table that is using Editor layer that menu is non existent. The default seems to be a table with 10 rows with no option to change. Looking at the examples on your editor pages I'm not seeing any of the tables that allow for changing number of rows that table displays when using editor layer.
Can you show me the initialisation you are using for your Editor table please?
If it is something like this example you would do:
Or add the
pageLengthbutton to thebuttonsarray:This goes back to my point that an Editor based DataTable is still just a DataTable. The regular initialisation I use in a lot of the Editor examples replaces the page length change option with buttons, but it can readily be put back in!
Allan
As Allan said I misunderstood your question. The answer is in the FAQ Allan linked to . Here is a running example with your
lengthMenusetting:https://live.datatables.net/vibovasu/1/edit
If you don't want the button but want the select list then add the
pageLengthparameter back using thelayoutoption.Kevin