special output formatting issue

special output formatting issue

ben976ben976 Posts: 6Questions: 0Answers: 0
edited April 2012 in General
HI All,

I'm having a problem adding links to a row and have been searching everywhere and still going round in circles. My issue is similar to http://www.datatables.net/forums/discussion/2797/adding-links-to-record-field/p1 but not quite the same problem...

I have been trying to add links to a field using this code;

[code]
else if ($aColumns[$i] == 'title') {
$row[] = "".$aRow[$aColumns[$i]]."" ;
}
[/code]

and am ending up with this error:

Uncaught TypeError: Cannot call method 'replace' of null jquery.dataTables.js:2302

Other special column outputs are working fine (without links but with string changes) and I get json_encode() warnings (invalid UTF-8 sequence) in the error_log. I've tried using escaped " instead of the ' and have even tried just $row[] = ''.$aRow[ $aColumns[$i] ].'' ; and still have the same Uncaught Type Error. (But $row[] = '123'.$aRow[ $aColumns[$i] ].'321' ; works fine.)

It looks like it's working though since I can see the table below the loading box but since the error is thrown the UI isn't unblocked and it appears to be loading forever. To make it even more confusing the same code works perfectly on my dev server. I also tried using < and > and it then worked but didn't render the links and sorts incorrectly.

Sorry if it's something obvious but I'm loving using DataTables and this seems like it should be so simple. Any help would be greatly appreciated!

If the full trace is helpful it's here...

Uncaught TypeError: Cannot call method 'replace' of null jquery.dataTables.js:2302
_fnDataToSearch jquery.dataTables.js:2302
_fnBuildSearchRow jquery.dataTables.js:2240
_fnBuildSearchArray jquery.dataTables.js:2213
_fnFilterComplete jquery.dataTables.js:2047
_fnSort jquery.dataTables.js:3926
_fnInitialise jquery.dataTables.js:2487
DataTable jquery.dataTables.js:6532
e.extend.each jquery.js:2
e.fn.e.each jquery.js:2
DataTabl ejquery.dataTables.js:6116
(anonymous function) report-viewer.php:174
f.Callbacks.n jquery.js:2
f.Callbacks.o.fireWith jquery.js:2
w jquery.js:4
f.support.ajax.f.ajaxTransport.send.d jquery.js:4


Thanks in advance,

Ben

Replies

  • ben976ben976 Posts: 6Questions: 0Answers: 0
    Also the json validates correctly using jsonlint.com.
  • allanallan Posts: 63,277Questions: 1Answers: 10,424 Site admin
    I think this should be fixed in the current 1.9.1.dev nightly: http://datatables.net/download . I'll be packaging this up into 1.9.1 soon.

    Allan
  • ben976ben976 Posts: 6Questions: 0Answers: 0
    The nightly build works for me! Thanks Allan!

    Ben
  • ben976ben976 Posts: 6Questions: 0Answers: 0
    Just for my curiosity what was the problem? I'm really thinking about why it worked on my dev machine but not the production machine...
  • ben976ben976 Posts: 6Questions: 0Answers: 0
    Hi again,

    I'm afraid I spoke to soon. It now loads correctly but the same Uncaught TypeError is thrown when you try and sort on that row. Again it still works on my dev machine... I guess it must be something todo with the sorting functions?

    Thanks again,

    Ben
  • ben976ben976 Posts: 6Questions: 0Answers: 0
    Hi Allan and Co,

    Sorry to pester but I was wondering if there is anymore info or anything else I could try to sort this issue out. I have switched to the stable 1.9.1 version but still have the same error on our production server (but not development).

    Trace:

    Uncaught TypeError: Cannot call method 'replace' of null jquery.dataTables.1.9.1.js:11574
    $.extend.html-pre jquery.dataTables.1.9.1.js:11574
    _fnSort jquery.dataTables.1.9.1.js:3885
    fnInnerSorting jquery.dataTables.1.9.1.js:4082
    iColumns jquery.dataTables.1.9.1.js:4093

    Thanks again,
    Ben
  • allanallan Posts: 63,277Questions: 1Answers: 10,424 Site admin
    Hi Ben,

    Can you link me to your example so I can see what might be going wrong?

    Thanks,
    Allan
This discussion has been closed.