Row Toggle Action Icon/Button
Row Toggle Action Icon/Button
I'd like to implement a "Mark as Read" icon or button.
I envisage this as similar to the way gmail and such work.
It would operate rather like the delete button on the following example, but would automatically update the backend without a confirmation dialog. It would also need to change something visual on the row - ideally styling and the icon (eg a closed vs open envelope icon).
https://editor.datatables.net/examples/inline-editing/fullRow.html
Pointers would be appreciated!
Thanks
Joe
Answers
If you are using Editor then maybe something like the checkbox example will work. You can add some code to
rowCallback
to highlight the row based on the whether its marked as read or unread. Similar to this example but userowCallback
instead.Kevin
Yes, using Editor, hadn't thought to use checkboxes.
Functionally that would work but ideally I'd like an icon, so that I can have read, flagged, etc as more clear in the UI...
You can use icons. Maybe different values for each one depending on how you store them in the DB. It will take some slight modifications of the
columns.render
function to display the icons. Modification of the event handler to send the selected value to the DB androwCallback
to perform the appropriate highlighitng.Kevin
Maybe use 0 for unread, 1 for read, 2 for flagged, etc. You can combine the values and if it has, for example, a 1 and 2 you can mark it as read and flagged.
EDIT: Or you can just have different fields in the row data for read, flagged, etc.
Kevin