Get field for cell

Get field for cell

sliekenssliekens Posts: 97Questions: 17Answers: 2

Is there a way to get a field name or field instance for a <td> element or in fact any object that looks like a cell-selector?

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Yes - column().dataSrc(). Assuming that the column data point (columns.data) matches the Editor field data point.

    Allan

  • sliekenssliekens Posts: 97Questions: 17Answers: 2

    Ah yes, thank you!

  • sliekenssliekens Posts: 97Questions: 17Answers: 2
    edited June 2017

    Unfortunately that method ignores columns.editField. :neutral:
    Any way to get a column's editField (if any) from the API?

    PS: I'm trying to get the field inside a preOpen handler after calling inline(). So I have a hunch that Editor already knows which field will be edited. I just don't know how to pull that information out of the API.

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    It does. I'm afraid there isn't actually a public API for that at the moment. You would need to use table.settings()[0].aoColumns[i].editField to get that property at the moment. It would be best to create a plug-in API method for it. Even better would be to have a plug-in method that would check for that parameter, if defined, return that, if not return column().dataSrc().

    Allan

This discussion has been closed.