server-side processing: process data on client before display

server-side processing: process data on client before display

beginner_beginner_ Posts: 55Questions: 2Answers: 0
edited June 2011 in General
Hi All,

I would like to use server-side processing. The issue is that the data of 1 column needs to be displayed in a ActiveX control (IE) or plugin (FF) (3rd party). For displaying this control/plugin, a javascript function must be called, which determines whether to use activex or plugin.
After getting the data from the server I would need to call that function on the client. The function also accepts the data as parameter and then displays the plugin.

How can i do that?

EDIT:

I tried rowCallback. The issue is that I want to set the html for the first column to a script. However the "<" sign in "" breaks the string. Error: unterminated string literal. How can I fix this? of course &lt removes the error but then the end tag is not recognized as html -> does not work.

[code]
var dataURL = "'data:chemical/smiles," + aData[0] + "'";

var html = ''
+ 'cd_insertObject("chemical/x-daylight-smiles", 182, 172,'
+ '"CDCtrl' + iDisplayIndexFull + '","","True","False","True",'
+ 'dataurl='+ dataURL + ');'; //here the error occurs

$('td:eq(0)', nRow).html(html);
[/code]

EDIT2:
tried to use \u003C for a "<" eg:
[code]
...
+ 'dataurl='+ dataURL + ');\u003C/script>';

$('td:eq(0)', nRow).html(html); // new error here: $ not defined
[/code]

Now for the last line, i get a $ not defined error. Which is a joke because all of the code is running in $(document).ready(function(). So it clear is defined? does the \u003C not work I assume?

Replies

  • beginner_beginner_ Posts: 55Questions: 2Answers: 0
    Solution:
    jQuerys .html() function strips away script tags. I found that in the comments the documentation for .html().

    Another issue is that the 3rd party function cd_insertObject uses document.write().

    My solution was to copy+paste cd_insertObject but instead of using document write i return a string and then i put this string in

    $('td:eq(0)', nRow).html(html);
This discussion has been closed.