Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dale Allen on Mar 10, 2009 05:54
open dhtmlx forum
Loading JSON date into an ASP page within a dhtmlxTree

Hi Guys,

I've finally gotten round to trying your software. I want to place a dhtmlxTree inside a dhtmlxTabbar and I need to Tree to load dynamic JSON data from an ASP page that calls data from SQL server. First off, can this be done and is it the best way of doing it? e.g. is there a way to avoid ASP (which is the only server side language I can use)

so far I am calling the a ASP page as below

    <table style="margin:15px;">
<tr>
            <td>
                <div id="treeboxbox_tree" style="width:500;height:500;background-color:#FFFFFF;border:0px solid Silver;overflow:auto;"/>
            </td>
            <td rowspan="2" style="padding-left:25" valign="top">

        
            </td>
        </tr>
        <tr>
            <td> </td>
        </tr>
    </table>
    <script>
            tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
            tree.setImagePath("code/dhtmlxTree/codebase/imgs/csh_bluebooks/");
            tree.setXMLAutoLoading("portal/organisation/tree.asp");
            tree.setDataMode("json");
            //load first level of tree
            tree.loadJSON("portal/organisation/tree.asp?id=0");
    </script>

...and that's where I get stuck and can't find anything on the web to help me. Do you have an example of someone who has tried this before I can work from? I envisaged that the tree would load dynamically from the ASP page as the user clicked the tree items and it then in turn called the next piece of data from the tree. I have no idea how to structure the JSON data within an ASP page. Would really appreciate some guidance. Once I get my head round it I will be flying!

Dale
Answer posted by Alex (support) on Mar 10, 2009 06:34

Hi Dale,

Unfortunately we don't have the ready asp sample. But the tree package contains the sample which demonstrates dynamic loading with PHP server-side:

dhtmlxTree/samples/json_support/pro_dyn_loading_json.html.

Answer posted by Dale Allen on Mar 10, 2009 07:25

Unfortunately I do not know php.  This puts in a position where I cannot move forward without an ASP/JSON example.  Is there anything you can do to help as I really really want to buy your software and don't want to have to start again elsewhere.  The tutorial here provided with an ASP example is fantastic. http://dhtmlx.com/docs/products/dhtmlxGrid/doc/step-by-step/ch_biggrid.html

I'm praying for something incredible to happen!!!  A very simple basic would be greatly appreciated. dale

Answer posted by Alex (support) on Mar 10, 2009 09:37

Dear Dale, 

The server-side script ("portal/organisation/tree.asp") recieved only id parameter with request - the parent item id.

All you need is to generate output stream in the necessary format. This format is used in the other json samples of the tree (for example, data.json) - so, doesn't require additional description. What details do you need ?

Answer posted by Dale on Mar 10, 2009 10:39
Thanks mate, let me take a look at this then get back to you if I need anything.  I come back either way.  Thanks.
Answer posted by Dale on Mar 10, 2009 10:56
I got it working, this is awesome stuff.  Thank you.