mRender error after use 1.10 release

mRender error after use 1.10 release

jijlijijli Posts: 5Questions: 0Answers: 0
edited October 2014 in Free community support

Hello,
I used datatable release 1.9 before, and used "fnRender" in my datatable column.
I tried to upgrade to the new release 1.10. I found "fnRender" is removed, and replaced by "mRender". I tried it as below. But when I ran it, I got the error as following. Do you have any idea on this? Thanks.

Uncaught TypeError: Cannot read property 'aoColumns' of undefined      search.htm:422
$.dataTable.aoColumns.mRender                                                             search.htm:422
(anonymous function)                                                                                jquery.dataTables.js:1175
oCol.fnGetData                                                                                         jquery.dataTables.js:668
_fnGetCellData                                                                                         jquery.dataTables.js:1068
_fnColumnTypes                                                                                      jquery.dataTables.js:840
_fnSort                                                                                                     jquery.dataTables.js:4482
_fnReDraw                                                                                              jquery.dataTables.js:2037
(anonymous function)                                                                            jquery.dataTables.js:3251
baseAjax.success                                                                                  jquery.dataTables.js:2398
m.Callbacks.j                                                                                           jquery.js:2
m.Callbacks.k.fireWith                                                                                  jquery.js:2
x                                                                                                     jquery.js:4
m.ajaxTransport.send.b                                                                jquery.js:4
"aoColumns" : [
            {"mDataProp" : "sup"},
            {"mDataProp" : "url",   
                "mRender" : function(o) {           
                    var url = o.aData[o.oSettings.aoColumns[o.iDataColumn].mDataProp];
                    if (url != "")
                        return "<a href="+url+" target='_blank'>"
                                + url
                                + "</a>";
                    else return "";
                }
            },
          {"mDataProp" : "phone"}
    ],

Replies

  • jijlijijli Posts: 5Questions: 0Answers: 0

    I don't know how to post. It looks so ugly. Can you please help me to cancel it? Thanks.

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Post formatting is Markdown based.

    Regarding the issue the o property in your mRender function is already the data defined by url. See the columns.render documentation for an example of creating a link.

    Allan

This discussion has been closed.