That's a really good point. I'd say that it should be the server that should decide if the client-side should be supplied with the options or not, since the server-side is authoritive on if the user is logged in and what permissions they have. Fields have ->set() and ->get() methods that can be used to control permissions - possibly Options should have something like that as well...!
Thanks, @allan -- mine might not be the best setup, but the way I handle it is that the server determines what the page will contain based on permissions and only visitors with editing permission are served the DataTable Editors.
Essentially all visitors get served the DataTables but visitors with editing permissions also get served the Editors.
There's obviously some client-side checking of permissions, such as whether to show the editing buttons, etc., but that's easily done without altering the data for table itself and I don't believe compromises security.
Anyway -- I hope I can convince you to include an option to just do a quick AJAX call for some initial options!
Sorry I've not managed to work on these changes yet - I'm working on a new extension for DataTables at the moment. Once done I'll be circling back to this!
Answers
That's a really good point. I'd say that it should be the server that should decide if the client-side should be supplied with the options or not, since the server-side is authoritive on if the user is logged in and what permissions they have. Fields have
->set()
and->get()
methods that can be used to control permissions - possiblyOptions
should have something like that as well...!Allan
Thanks, @allan -- mine might not be the best setup, but the way I handle it is that the server determines what the page will contain based on permissions and only visitors with editing permission are served the DataTable Editors.
Essentially all visitors get served the DataTables but visitors with editing permissions also get served the Editors.
There's obviously some client-side checking of permissions, such as whether to show the editing buttons, etc., but that's easily done without altering the data for table itself and I don't believe compromises security.
Anyway -- I hope I can convince you to include an option to just do a quick AJAX call for some initial options!
And thanks for the exceptional support!
CSS
Setting
fields.className
to'block'
fortags
seems to cause the dropdown to be placed lower than what it should be.This might be my CSS interfering, although I don't think it is . . .
Just following up on the above post about the CSS.
To duplicate, view the following link in mobile mode and create a new entry to see the dropdown for the country
tags
is too low for the control (see picture):https://editor.datatables.net/examples/dropdown/tags-rendering.html
If there was an editor field below the country tag on the form then it would show between the country tag and the dropdown.
Processing indicator for AJAX
Another request for AJAX -- a processing indicator on the table showing the options for when loading is slow.
That's a good idea!
Sorry I've not managed to work on these changes yet - I'm working on a new extension for DataTables at the moment. Once done I'll be circling back to this!
Allan
@allan -- I'm just using this thread to capture everything in one place.
I'm looking forward to when you get a chance to look at these suggestions but I'm excited to hear you're working on a new extension as well!