Editor data - use data-search instead of row data

Editor data - use data-search instead of row data

fabiochinofabiochino Posts: 2Questions: 1Answers: 0

Hello, i'm using DataTables Editor on a DataTable that loads its data from the DOM (i don't have a data dict in js) and for presentation reason, the table cells have some arbitrary html inside them.

for filtering, ordering and doing other stuff in the DataTable i put the actual data to be used in the data-search or data-order attribute.
Now i'm trying to use Editor, but if i "bind" an editor field to a column (setting the name of the field in editor the same as the columns.data setting in DataTable), the Editor form contains all the html from the row, while i would want to use the data in data-search instead.

Is it possible to do this?

some example data to clarify my problem:

This is the row in the DOM


and this is what is shown in Editor. i would want Editor to use the value in data-search instead of the html content

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,220Questions: 1Answers: 10,808 Site admin
    Answer ✓

    What's your data source here, and how are you looking to update the data? By the sounds of it you are reading the data from the DOM (i.e. you've got something creating an HTML table with the data-search attribute, etc), rather than having DataTables create it from a JSON data source. Is that right?

    If so, you could do name: '4.@data-search' to have Editor operate on the search attribute value, but updating the data isn't going to be so easy. It will write that value back to the object, but the rest of the HTML won't update since it isn't "connected" as Editor sees it (hence my initial question :)).

    Allan

  • fabiochinofabiochino Posts: 2Questions: 1Answers: 0

    Yes, that's exactly what i'm doing.
    It's ok , i will handle updating manually i guess, thank you!

Sign In or Register to comment.