Get editor field from column?
Get editor field from column?
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
Even just a way to get the columns.editField option from a column instance would be fine
https://datatables.net/reference/option/columns.editField
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);
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