--- layout: post title: Does Datatables need better integration? tags: - datatables - Development - functional - javascript status: publish type: post published: true meta: _edit_last: '1' --- Over these last two months, I've been working with Datatables, an amazing easy-to-setup steroid machine for HTML tables. For the kind of work I'm doing right now, it suits my needs just perfectly. A couple of weeks ago I needed to build a plugin for DT: MultipleFilters, something that would allow me to filter data by a range. Each column would have a pair of fields and I would have to mix them into the bowl of parameters to send to the server . It looked fun, so I started doing it, hoping to achieve a beautiful Javascript prototype object that would do magic when plugged in by a single letter. As I was finishing building it, I realized some issues had to be fixed. Disclaimer: The plugin does not approach local processing, only server-side.
fnServerData
option in the initializer. That's not what the end user wants, he wants to just download the plugin, place it in and there, it does range filtering.
My suggestion here would be an array of functions (perhaps called afnbeforeSend
) that allowed any plugin builder to be able to inject parameters to be sent. That way, when my plugin is initialized, I can push my function that injects such parameters and I don't pollute the initializers.
ColVis
. Wouldn't it be great if both ColVis
and ColReorder
had some sort of array of callbacks we could populate? When ColVis
toggled a column, I could access it and toggle my filter controls accordingly. When ColReorder
dragged a column around, I could know which one and to where it moved. All of this without requiring additional initialization and granting cohesion, based on a functional approaching.
For what it's worth, I actually had to hack inside ColReorder and add some code in there so I had to accomplish some integration between MF and CR.