Columns Created/Render Events And Inline Editor

Columns Created/Render Events And Inline Editor

rosamaria.castillocolladorosamaria.castillocollado Posts: 3Questions: 0Answers: 0
edited October 2014 in Editor

Hi,

We have implemented a data table where some of the columns change the "td that contains data" based into another data that is pulled from the server. For instance:

$('#table').DataTable({ .....
          ajax: ......,
          columns: [ ....,
            {
                         data: "TargetDate",
                        className: "center",
                        createdCell: function (td, cellData, rowData, row, col) {
                           $(td).addClass(rowData["TargetDateClass"]);
                        }
              },.....
           ],.......
 })

As you can see the td set a class based in the column "TargetDateClass" (pulled as a json from server)
Previously of using the event "createdCell" I did try to use the "render" event and render a span where i can set the class.
Unfortunately set a span within the TD does break/malfunction the Datatables Editor plugin.
So I moved to the "createdCell" event

On the other side using "createdCell" only renders/adds the class that is pulled from the server when the whole table is render but NOT IN CASE of a inline editing: when a row CHANGES.... Probably this is why the event is called createdCell

As you can see I havent found the solution to set classes arround the data (TD or span) rendered in the DataTables using the Editor plugin using createdCell or render events

                                                        -------------------------------------------

Is it possible to recreated the whole row when editor plugin changes the data because of a "Edit Function"? (whitout refreshing the whole Table)

Can i achieve what i'm trying to do using a workarround or another event?

Any ideas are wellcomed!

Thanks in advance, Jacobo

Replies

  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin

    In what way does using a span break Editor? That seems like the best solution to me.

    The alternative is to use rowCallback which should work nicely as well in this case.

    Allan

This discussion has been closed.