1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    1
    Vote Rating
    0
    globetrottersam is on a distinguished road

      0  

    Question Problem getting JSON data in TreeLoader

    Problem getting JSON data in TreeLoader


    ---------------------------------------------
    dependency.js used from example in ExtJs
    --------------------------------------------

    // this is the source code tree
    var stree = new xt.TreePanel('source-files', {
    animate:true,
    loader: new xt.TreeLoader({dataUrl:'/IONSWeb/servlet/TaskManagementServlet'}),
    enableDrag:true,
    containerScroll: true
    });

    var croot = new xt.AsyncTreeNode({
    allowDrag:false,
    allowDrop:true,
    id:'croot',
    text:'Project Components',
    cls:'croot',
    loader:new Ext.tree.TreeLoader({
    dataUrl:'/IONSWeb/servlet/TaskManagementServlet',
    createNode: readNode
    })
    });

    ---------------------------------------------------
    Servlet Code
    -----------------------------------------------------

    logger.info("Creating JSON");

    JSONArray ewr =
    new JSONArray();
    JSONObject er=
    new JSONObject();
    er.put(
    "id " ,"100");
    er.put(
    "text","SITE RESEARCH ");
    er.put(
    "leaf","true");
    ewr.add(er);
    er=
    new JSONObject();
    er.put(
    "id " ,"200");
    er.put(
    "text","EQUIP RESEARCH ");
    er.put(
    "leaf","true");
    ewr.add(er);

    er=
    new JSONObject();
    er.put(
    "id","300");
    er.put(
    "text" ,"SITE CODE");
    er.put(
    "leaf","true");
    ewr.add(er);

    er=
    new JSONObject();
    er.put(
    "id","400");
    er.put(
    "text","EQUIPMENT VERIFICATION ");
    er.put(
    "leaf","true");
    ewr.add(er);
    er=
    new JSONObject();
    er.put(
    "id","500");
    er.put(
    "text","EQUIPMENT ORDER ");
    er.put(
    "leaf","true");
    ewr.add(er);

    responseString.append(ewr.toString());

    logger.info("Created JSON");



    logger.info("RS: "+responseString.toString());
    response.setContentType(
    "text/html");
    response.getWriter().write(responseString.toString());

    -----------------------------------------------------------------
    Servlet Output
    -----------------------------------------------------------------

    [{"text":"SITE RESEARCH ","id ":"100","leaf":"true"},{"text":"EQUIP RESEARCH ","id ":"200","leaf":"true"},{"text":"SITE CODE","leaf":"true","id":"300"},{"text":"EQUIPMENT VERIFICATION ","leaf":"true","id":"400"},{"text":"EQUIPMENT ORDER ","leaf":"true","id":"500"}]

    -----------------------------------------------------------------
    Jsp Code
    -----------------------------------------------------------------

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>PROJECT VIEW </title>
    <script type="text/javascript" src="/IONSWeb/adapter/yui/yui-utilities.js"></script>
    <script type="text/javascript" src="/IONSWeb/adapter/yui/ext-yui-adapter.js"></script>
    <script type="text/javascript" src="/IONSWeb/resources/script/ext-all-debug.js"></script>

    <script type="text/javascript" src="/IONSWeb/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="/IONSWeb/resources/script/ext-all.js"></script>
    <script type="text/javascript" src="/IONSWeb/resources/script/dependency.js"></script>
    <link rel="stylesheet" type="text/css" href="/IONSWeb/resources/css/ext-all.css">
    <link rel="stylesheet" type="text/css" href="/IONSWeb/resources/css/ytheme-vista.css">

    </head>
    <body>
    <div id="main-ct" style="width:700px;height:500px;"></div>
    <script>
    </script>

    </body>
    </html>

    -----------------------------------------------------------------
    Output of Jsp
    -----------------------------------------------------------------

    Empty tree with no data

    CAN ANYONE SUGGEST WHAT IS WRONG??

    THANKS A LOT


  2. #2
    Sencha - Training Team RWaters's Avatar
    Join Date
    Mar 2007
    Location
    Los Angeles, CA
    Posts
    714
    Vote Rating
    0
    RWaters is on a distinguished road

      0  

    Default


    are you setting croot as the root node of your tree?

    Code:
    stree.setRootNode(croot);
    Also please remember Code tags

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi