Results 1 to 2 of 2

Thread: How to call a normal javascript in the zimlet?

  1. #1
    Join Date
    Jul 2007
    Posts
    17
    Rep Power
    8

    Default How to call a normal javascript in the zimlet?

    I have a zimlet which talks to JSP and gets an XML response. I am giving an Ajax call to jsp page. SO in the callback function i get the "result.text" as XML. I parse it to form an html and display the data in the table form within zimlet dialog box. Following is the code snippet of the callback method.

    com_mycomp_vm.prototype.onDoneRetrieve= function(result){

    var txt = result.text;
    my_html = this.par***ML(txt);

    var view = new DwtComposite(this.getShell());
    var el = view.getHtmlElement();

    var div = document.createElement("div");

    div.innerHTML=my_html; //CONTENT OF THE DIALOG BOX
    alert(div.innerHTML);
    el.appendChild(div);

    //ARGS OF THE DIALOG BOX
    var dialog_args = {
    title : "Welcome",
    view : view,
    standardButtons : [DwtDialog.OK_BUTTON]
    };

    //CREATION OF THE DIALOG BOX
    var dlg = this._createDialog(dialog_args);

    //TEXT DISPLAYED ON THE OK BUTTON
    dlg.getButton(DwtDialog.OK_BUTTON).setText("Close" );
    dlg.popup();

    }

    In the parse method, I parse the data and form an HTML as follows:
    com_mycomp_vm.prototype.par***ML = function(txt){

    ....
    .....
    html_table = "<table class='sortable' id='anyid' cellpadding='0' cellspacing='0'><tr><th>From</th><th>Subject</th><th>Size</th><th>Date</th><th>Attachment</th></tr>";
    html_table = html_table + html_row + "</table>";


    my_html = my_html + "<head> <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /><title>Sortable table example</title>";
    my_html = my_html + "<link rel='stylesheet' type='text/css' href='example.css'/><link href='http://www.joostdevalk.nl/' rev='made' />";
    my_html = my_html + "<script type='text/javascript' src='sortable.js'></script></head>";
    my_html = my_html + "<body>" + html_table + "</body>";

    return(my_html);
    }

    In the table tag that I have created, I am trying to apply a class='sortable' to it. This is defined in a sortable.js file which is a simple javascript file(not zimletbase) which sorts the table as you click on the columns. If I apply this code to my simple html file it sorts the table. But then in this case it deos not. Could anybody tell me how can I do it?

  2. #2
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    367
    Rep Power
    8

    Default

    If you use firebug, does it give you any error?
    Also, did you included the js file in com_mycomp_vm.xml like this :
    Code:
    	<include>sortable.js</include>

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. Invoking Zimlet JSP from Zimlet Javascript
    By Chewie71 in forum Zimlets
    Replies: 0
    Last Post: 12-22-2008, 10:12 PM
  3. Outlook 2007 Beta error
    By bersrker in forum Zimbra Connector for Outlook
    Replies: 13
    Last Post: 07-17-2008, 08:38 AM
  4. Replies: 5
    Last Post: 01-11-2008, 05:34 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •