DataTable removes internal API,changelog says to use Public API but how?jquery-datatables-checkboxes

DataTable removes internal API,changelog says to use Public API but how?jquery-datatables-checkboxes

sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0

Link to test case:
https://github.com/gyrocode/jquery-datatables-checkboxes

Debugger code (debug.datatables.net):
None

Error messages shown:
TypeError: DataTable.ext.internal._fnColumnOptions is not defined or undefined

Description of problem:

I'm updating datatables major to v2 and I faced an issue with https://github.com/gyrocode/jquery-datatables-checkboxes cause it still uses internal API, can you guys guide me on how to update that internal API to use public API?

This question has an accepted answers - jump to answer

Answers

  • sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0
  • sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0

    Can you guys please also update https://datatables.net/plug-ins/index some of these functions still using internal or v1 APIs

  • kthorngrenkthorngren Posts: 21,354Questions: 26Answers: 4,956

    The Gyrocode Checkbox plugin is a third party provided plugin. The developer of the plugin will need to update the code to support Datatables V2. I see you opened an Issue in the Github repo. An alternative is to use the checkbox solution provided by the Select extension. See this example.

    There are many plugins. Can you provide a list of specific plugins you are using that aren't working with 2.0? Allan can then comment on those plugins.

    Kevin

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    I need to work my way through the plug-ins, ScrollResize doesn't work. I'm not sure about the other ones yet.

    Allan

  • sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0

    @kthorngren hey thanks for the answer, and yes I know about select and checkbox examples, I want to make my checkboxes like bootstrap checkboxes

    "How to customize DataTables default checkbox render/style"


    Yes there are many plugins but I'm only using jquery-datatables-checkboxes

    I only know gyrocode plugins and alteditor plugin

    https://github.com/KasperOlesen/DataTable-AltEditor

  • kthorngrenkthorngren Posts: 21,354Questions: 26Answers: 4,956

    Yes there are many plugins but I'm only using jquery-datatables-checkboxes

    These plugins are provided by a third party developer. That developer will need to update their plugins to support Datatables 2.0.

    How to customize DataTables default checkbox render/style

    What do you want to change?

    You can right click and inspect the checkbox to see the styles applied and the selectors to use. You should be able ot override the styles in your style section.

    Kevin

  • sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0

    @kthorngren

    What do you want to change?

    For example, I want to have the same markup and style as Bootstrap checkbox

    https://getbootstrap.com/docs/5.3/forms/checks-radios/#checks

    <div class="form-check">
      <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
      <label class="form-check-label" for="flexCheckDefault">
        Default checkbox
      </label>
    </div>
    

    because the default style does not look like interesting

  • sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0
    edited February 21

    These plugins are provided by a third party developer. That developer will need to update their plugins to support Datatables 2.0.

    If you are familiar with the JS structure of DataTables or DataTables breaking changes, why not help them or at least help me on that issue in https://github.com/gyrocode/jquery-datatables-checkboxes

  • kthorngrenkthorngren Posts: 21,354Questions: 26Answers: 4,956

    If you are familiar with the JS structure of DataTables or DataTables breaking changes, why not help them

    I'm not the developer of Datatables and don't know all the breaking changes made. @allan's main concern is to make sure his code base, of which there are is a lot of code, works correctly with 2.0.

    The Gyrocode Checkboxes library has a lot of code and it would take a lot of time for someone unfamiliar to dig through to understand how the code works to make suggestions. Its not as simple as saying instead of using DataTable.ext.internal._fnColumnOptions use this API. An understanding of how that API is used is needed to offer suggestions.

    The developer is free to ask questions and provide specifics around what they are doing to get help. I believe the software is open source which allows you to make changes. You could create a pull request and start debugging the DataTable.ext.internal._fnColumnOptions API calls to learn what they do with 1.13 then ask, on the forum, how to accomplish the same with 2.0. There are a lot of people using Gyrocode's Checkbox library and I'm sure they will appreciate the effort.

    I want to have the same markup and style as Bootstrap checkbox

    @allan might be able to help with styling the checkboxes like Bootstrap. I'm not that familiar and not sure all the changes needed.

    Kevin

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    Select 2.0 for DataTables has proper checkbox support, and it looks to me from the bootstrap code that we just need to use the class form-check-input on the input to make it styled via Bootstrap.

    It isn't currently configurable in Select, but I see no problem in making it so. I've added it to my list of things to do.

    Regards,
    Allan

  • sadeghbaratisadeghbarati Posts: 14Questions: 4Answers: 0
    edited February 22

    Thank you guys! <3

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin
    Answer ✓

    Finally gotten around to doing this :). It will be in the next release of Select.

    Allan

Sign In or Register to comment.