Using mRender on a column with HTML

Using mRender on a column with HTML

TronikTronik Posts: 122Questions: 28Answers: 1

Hi!

I have an issue with implementing the responsive extension to my datatable. When the table collapses into responsive design the link will not show, but only the "data" variable

Im using the following function to create a link in the column:

      {
            "mData": "id",
            "sClass": "center",
            "mRender": function (data, type, full) {
    return '<a href="" class="editor_edit">Change</a> / <a class="update" href="php/update.php?id=' + data +    ' ">Update</a>';
            }
        }

I can provide a test case if thats needed, but I thought maybe someone was already familiar with the issue.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Yup you are right. It is the raw data that is displayed rather than the rendered data.

    There isn't currently a way around this other than to create your own child renderer (responsive.details.renderer) and have it read the rendered value from the HTML.

    Something I'll look into adding in a future version.

    Allan

  • TronikTronik Posts: 122Questions: 28Answers: 1

    Ok, thank you!

  • TronikTronik Posts: 122Questions: 28Answers: 1

    If you dont mind me asking a related question...

    How can I word-wrap the cells in the responsive container?

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Use white-space: normal; in the CSS I would imagine. Targeting whatever cell / row / element, etc that you need.

    Allan

  • TronikTronik Posts: 122Questions: 28Answers: 1

    Added this to the css and it worked, thanks!

    td.child {
    white-space: normal;
    }

This discussion has been closed.