Datatable check type of column like html , string , date

Datatable check type of column like html , string , date

Harsh DamaniaHarsh Damania Posts: 8Questions: 4Answers: 0
edited June 2017 in Free community support

I am using "aoColumns": [null, { "sType": "html" } , null, { "sType": 'date' }]; in datatble options.
Using code i need to check the sType like
this.api().columns().every(function () {
var column = this;

// here i need to find the sType });

Any help please ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Answer ✓

    You shouldn't ever need to set the columns.type option yourself - certainly not for the options that DataTables provides internally. If it isn't auto-detected as the correct type, then the sorting won't support that type (due to some data in the column not matching that type).

    There currently isn't an external API to get the column type. What do you need that information for?

    Allan

  • Harsh DamaniaHarsh Damania Posts: 8Questions: 4Answers: 0

    Hey Allan,
    Thank you very much for your reply but i used this and it works
    column.context[0].aoColumns[column.selector.cols].sType == "html"
    I need to perform some javascript operation when column type is html and then pass it to search by creating regex.

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    It might work for now, but you shouldn't need to get/set internal properties. That might break in future versions!

    Allan

  • Harsh DamaniaHarsh Damania Posts: 8Questions: 4Answers: 0

    Oki...Thanks

This discussion has been closed.