EasyUI Forum
September 13, 2025, 09:21:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Is there a way to change url of 'state' in combotree ?  (Read 10415 times)
varonica
Full Member
***
Posts: 106


View Profile
« 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 Sad Sad Sad
« Last Edit: December 19, 2012, 02:29:24 AM by varonica » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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';
Logged
varonica
Full Member
***
Posts: 106


View Profile
« Reply #2 on: December 19, 2012, 06:46:25 PM »

thz for replying me. and here is the code Smiley
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 Sad Sad Sad !!!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!