Get editor field from column?

Get editor field from column?

csdatumcsdatum Posts: 30Questions: 10Answers: 0

I'm creating a custom pop-up window to handle searching & colvis on each column.
To do that, I'm just looping through columns().every() to add elements to the pop-up window.
It works great for text fields, but for drop-down fields with options, I want to have the user be able to select which values they want to see. I want to be able to get all of the options that editor uses to populate the drop-downs in the table.

Something like
dt.editor().field(fieldName).node()
would work fine, IF i could get fieldName from a column() instance... but I don't know how to do that. Is there any way to get an editor.field() instance that is attached to a dt.column() instance?

This question has an accepted answers - jump to answer

Answers

  • csdatumcsdatum Posts: 30Questions: 10Answers: 0

    Even just a way to get the columns.editField option from a column instance would be fine

    https://datatables.net/reference/option/columns.editField

  • csdatumcsdatum Posts: 30Questions: 10Answers: 0
    edited August 2017

    It's a little hacky, but for anyone wondering, I was able to get this working by defining editField in the options and using:

    var colIdx=0;
    var field=dt.editor().field(dt.init().columns[colIdx].editField);

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Hi,

    Yes, that's really the only way to get that value at the moment, as there isn't a public API for that information. Something I need to fix!

    Allan

This discussion has been closed.