Question about desired features for plugin feature that creates a footer

Question about desired features for plugin feature that creates a footer

jLinuxjLinux Posts: 981Questions: 73Answers: 75
edited November 2015 in Plug-ins

I have quite a few custom DT related plugins for feature enhancement or API enhancement. Most of them are just little tiny scripts, nothing really important enough to be in its own plugin. So I started to create a dataTables.customMisc.js file thats going to contain all of the API/Feature enhancing plugin scripts, and ill share it once its done.

One of the little features, is an init setting for DataTables to create a footer on a table that doesn't have one initially. You can create a table tag, then initialize DataTables on that, and DT will automatically create the thead and tbody, but it wont create the tfoot, so I just decided to create an option to do that.

So basically, I was just wondering if theres any feature requests out there. I did a search for this, and I found around 6 threads where people were asking if there was a way to create a footer dynamically. Im wondering if theres anything extra youd want to be able to do to it if there was such an option.

Heres a JSBin instance with an example of what I mean.

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    I'm not aware of anyone having coded this up before. The reason I've always held off from doing it, is that often the footer will include colspan / rowspan which adds complexity. I figured it was easier for everyone to just add the footer using DOM/jQuery methods, although I can see in the simple case of one column === 1 footer cell, it might be useful to just toggle an option.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Oh you mean if they do something like this? I see what you mean... Good point

    And I guess a side question, I know DT adds the class no-footer, but is it possible for anything to change that? Or for developers to over-ride that class?

    Instead of hardcoding that class directly, I was trying to reference the variable that would hold it, which I believe is DataTable.ext.classes.sNoFooter? But I couldn't find a way to get my hands on that from the plugins API..

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Yes - exactly like that. My feeling is that colspan / rowspan is more common in the footer, but it will still be less that 50% of the time.

    but is it possible for anything to change that?

    Just remove it in an init event if you've added it. That's probably the only way at the moment.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Just remove it in an init event if you've added it. That's probably the only way at the moment.

    No no, I mean is it possible for someone to set their own class as a value for the DataTable.ext.classes.sNoFooter? As opposed to the default no-footer? just wondering if theres a better way to go than hardcoding no-footer in the plugin itself.. Id like to get it dynamically if possible. Poked around the DT JS code, didnt see a way though.

This discussion has been closed.