EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: varonica on December 19, 2012, 02:26:16 AM



Title: Is there a way to change url of 'state' in combotree ?
Post by: varonica on December 19, 2012, 02:26:16 AM
Code:
//html
<select id="tree" class="easyui-combotree" data-options="url:'getdata.php ' " style="width:200px;" />

Code:
//getdata.php
global $wpdb;
$mini = $wpdb->get_results("SELECT * from tbl_ministry");
$result = array();
foreach($mini as $minis)
{
            array_push($result,array('id' => $minis->id,'text' => $minis->name,'state' => 'closed' ));
        }
echo json_encode($result);

Code:
//getdata1.php
global $wpdb;
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : ' ' ;

$gdp = $wpdb->get_results("SELECT * from tbl_gdepartment where MinistryId = $id ");

$r_gdp = array();
foreach($gdp as $gdps)
{
array_push($r_gdp, array('id' => $gdps->Id,'text' => $gdps->Name_KH));
}
echo json_encode($r_gdp);

Problem:
   All i want is when i expand one of them, they need to reload from other url(getdata1.php), not the current url(getdata.php).plz help me :( :( :(


Title: Re: Is there a way to change url of 'state' in combotree ?
Post by: stworthy on December 19, 2012, 02:55:57 AM
Try the following code to change the url for combotree component:

Code:
$('#tree').combotree('tree').tree('options').url = 'getdata1.php';


Title: Re: Is there a way to change url of 'state' in combotree ?
Post by: varonica on December 19, 2012, 06:46:25 PM
thz for replying me. and here is the code :)
Code:
onBeforeExpand: function(node){
      $('#tree').combotree('tree').tree('options').url = 'getdata2.php?id='+node.id;
}

But:
      Is there a way to change the url({ when we expand the parent('Folder'), so the current url('getdata1.php') will be changed to getdata2.php. After we expand the child('Sub Folder 1'), we expect it to change the url('getdata3.php') and get child('File 11'); }) ?.
Code:
// just an example 
    <ul id="tt" class="easyui-tree"> 
        <li> 
            <span>Folder</span> 
            <ul> 
                <li> 
                    <span>Sub Folder 1</span> 
                    <ul> 
                        <li> 
                            <span><a href="#">File 11</a></span> 
                        </li> 
                        <li> 
                            <span>File 12</span> 
                        </li> 
                        <li> 
                            <span>File 13</span> 
                        </li> 
                    </ul> 
                </li> 
                <li> 
                    <span>File 2</span> 
                </li> 
                <li> 
                    <span>File 3</span> 
                </li> 
            </ul> 
        </li> 
        <li> 
            <span>File21</span> 
        </li> 
    </ul> 

Sorry for my poor english, plz help me :( :( :( !!!