field anchor disappears after update

field anchor disappears after update

DealogicDealogic Posts: 5Questions: 0Answers: 0
edited June 2013 in Editor
Hi!

I added a created value via aoColumns at Datatables initialisation like this, so the content returned appears as a link, with the returned data as href:

"fnCreatedCell": function (nTd, sData, oData, iRow, iCol)
{
$(nTd).html('' + 'Link' + '')
}

But when I update the row via editor, the link (and I guess everything that could have been formatted in that row) disappears, with only the exact content/data returned in that field.

I am using PHP+MySQL.

What and where should be modified within the editor script (so that the same format would remain)?

(Sorry if something similar has been asked before, I looked for it but did not find anything exactly relateable.)

Many thanks!

Replies

  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    I'm not completely sure of your process, but I also wanted to have the display value be different than the database value, so I used mRender in the aoColumns. Editor and the table data structure have the actual data, it just runs the cell through mRender before displaying it.

    [code]
    {"sTitle":"External Case","mData":"externalcase","mRender":function (data,type,full)
    {
    return '' +data + '';
    }},
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    I'd agree with aaronw - use mRender to render the data output for display in the DataTable. That leaves the original data untouched and available for Editor to use. You could also check for `display` type and only return your HTML link for that type, and the raw data for everything else (sorting, etc).

    Allan
  • DealogicDealogic Posts: 5Questions: 0Answers: 0
    Thank you very much, mRender made it work like a charm!

    Cheers
This discussion has been closed.