zoukankan      html  css  js  c++  java
  • 雷林鹏分享:jQuery EasyUI 树形菜单

      jQuery EasyUI 树形菜单 - 创建异步树形菜单

      为了创建异步的树形菜单(Tree),每一个树节点必须要有一个 'id' 属性,这个将提交回服务器去检索子节点数据。

      创建树形菜单(Tree)

      

      url="tree2_getdata.php">

      

      服务器端代码

      $id = isset($_POST['id']) ? intval($_POST['id']) : 0;

      include 'conn.php';

      $result = array();

      $rs = mysql_query("select * from nodes where parentId=$id");

      while($row = mysql_fetch_array($rs)){

      $node = array();

      $node['id'] = $row['id'];

      $node['text'] = $row['name'];

      $node['state'] = has_child($row['id']) ? 'closed' : 'open';

      array_push($result,$node);

      }

      echo json_encode($result);

      function has_child($id){

      $rs = mysql_query("select count(*) from nodes where parentId=$id");

      $row = mysql_fetch_array($rs);

      return $row[0] > 0 ? true : false;

      }

      下载 jQuery EasyUI 实例

      jeasyui-tree-tree2.zip

      本文转载自:w3cschool(编辑:雷林鹏 来源:网络 侵删)

  • 相关阅读:
    python 将字符串转化为可执行代码
    NGS的duplicate的问题
    建库原理
    生信转岗心得
    openpyxl模块处理excel文件
    getopt两个模块getopt 和gun_getopt 的异同
    Migrate repo from Gitlab to Github
    flume(2)
    flume
    docker命令总结
  • 原文地址:https://www.cnblogs.com/pengpeng1208/p/10683564.html
Copyright © 2011-2022 走看看