Read options from HTML attributes

Read options from HTML attributes

nummer5nummer5 Posts: 9Questions: 3Answers: 0

We use DataTables 1.10 for quite a number of tables in a Plone site (HTML generated by TAL templates); in some of them, we use HTML attributes to configure specific options, e.g. an aaSorting attribute (old name from DataTables 1.9, I know) which can take values like 0,asc;7,desc for the order option.

Currently, we have an own function we call to check for those attributes, and which in turn calls the .dataTable method.

Is there perhaps a better way?
I could imagine to use a callback function which inspects the HTML table object and updates the given options;
this function could be applied by updating the defaults.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Hi @nummer5 ,

    The table can accept HTML5 attributes, see examples here and here. Is that what you're looking for?

    Cheers,

    Colin

  • nummer5nummer5 Posts: 9Questions: 3Answers: 0

    Yes, this will do; thank you.

This discussion has been closed.