亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#使用Jquery zTree實(shí)現(xiàn)樹(shù)狀結(jié)構(gòu)顯示 異步數(shù)據(jù)加載

 更新時(shí)間:2016年12月19日 11:47:36   作者:深入學(xué)習(xí)ing  
這篇文章主要為大家詳細(xì)介紹了C#使用Jquery zTree實(shí)現(xiàn)樹(shù)狀結(jié)構(gòu)顯示和異步數(shù)據(jù)加載,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

C#使用Jquery zTree實(shí)現(xiàn)樹(shù)狀結(jié)構(gòu)顯示_異步數(shù)據(jù)加載

JQuery-Ztree下載地址:https://github.com/zTree/zTree_v3

JQuery-Ztree數(shù)結(jié)構(gòu)演示頁(yè)面:  http://www.treejs.cn/v3/demo.php#_101

關(guān)于zTree的詳細(xì)解釋請(qǐng)看演示頁(yè)面,還有zTree幫助Demo。 

下面簡(jiǎn)要講解下本人用到的其中一個(gè)實(shí)例(直接上關(guān)鍵代碼了):

異步加載節(jié)點(diǎn)數(shù)據(jù): 

A-前臺(tái):

<link href="zTree_v3-master/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
 <script src="zTree_v3-master/js/jquery.ztree.core.js" type="text/javascript"></script>
 <script language="JavaScript" type="text/javascript">
 var setting = {
  async: {
   enable: true,
   url: "../Handler/ShoppingHandler.ashx", //請(qǐng)求的一般處理程序
   autoParam: ["id"],       //自帶參數(shù)id--來(lái)自于節(jié)點(diǎn)id
   otherParam: { "type": "GetUserLevelList" }, //其他參數(shù)自定義
   dataFilter: filter, //數(shù)據(jù)過(guò)濾
   type: "post" //請(qǐng)求方式
  }
 };

 function filter(treeId, parentNode, childNodes) {
  if (!childNodes) return null;
  for (var i = 0, l = childNodes.length; i < l; i++) {
   childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
  }
  return childNodes;
 }

 $(document).ready(function () {
  $.fn.zTree.init($("#treeDemo"), setting); //渲染樹(shù)結(jié)構(gòu)
 });
 </script>
<div class="zTreeDemoBackground left">
  <ul id="treeDemo" class="ztree"></ul>
</div>

B后臺(tái):

using MobileBusiness.Common.Data;
using MobileBusiness.Library.Passport;
using MobileBusiness.Shopping.Data;
using MobileBusiness.Shopping.Data.Common;
using MobileBusiness.Shopping.Data.Entity;
using MobileBusiness.Web.Library.Script;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ShoppingData = MobileBusiness.Shopping.Data.Entity;

namespace MobileBusiness.Shopping.BusinessManage.Handler
{
 /// <summary>
 /// Shopping 的摘要說(shuō)明
 /// </summary>
 public class ShoppingHandler : IHttpHandler
 {
  //當(dāng)前登錄用戶信息
  WeChatUser weChatUser = WeChatIdentity.CurrentUser;

  public void ProcessRequest(HttpContext context)
  {
   string result = "";
   if (context.Request["type"] != null)
   {
    string requestType = context.Request["type"];

    try
    {
     switch (requestType)
     {
      //獲取用戶信息等級(jí)列表
      case "GetUserLevelList":
       result = this.GetUserLevelList(context); break;
      default:
       break;
     }
    }
    catch (Exception ex)
    {
     result = ex.Message;
    }
   }

   context.Response.ContentType = "text/html";
   context.Response.Write(result);
   context.Response.End();
  }

  private string GetUserLevelList(HttpContext context)
  {
   string parentUserPhone = context.Request["id"];
   return GetUserCollByPhone(parentUserPhone);
  }
  private string GetUserCollByPhone(string phone)
  {
   //編碼,父編碼,名稱,是否打開(kāi),打開(kāi)圖片,關(guān)閉圖片
   //{ id:1, pId:0, name:"展開(kāi)、折疊 自定義圖標(biāo)不同", open:true, iconOpen:"../../../css/zTreeStyle/img/diy/1_open.png", iconClose:"../../../css/zTreeStyle/img/diy/1_close.png"},
   //編碼,父編碼,名稱,是否打開(kāi),顯示圖片
   //{ id: 11, pId: 1, name: "葉子節(jié)點(diǎn)1", icon: "../../../css/zTreeStyle/img/diy/2.png"},
   List<object> result = new List<object>();

   ShoppingData.UserInfoCollection userColl = ShoppingData.UserInfoAdapter.Instance.LoadByParentUserPhone(phone);
   userColl.ForEach(user =>
   {
    result.Add(new
    {
     id = user.Phone,
     pid = phone,
     name = user.UserName,
     isParent = ShoppingData.UserInfoAdapter.Instance.LoadByParentUserPhone(user.Phone).Count > 0 ? true : false
    });
   });
   return JsonConvert.SerializeObject(result);
  }
  public bool IsReusable
  {
   get
   {
    return false;
   }
  }
 }
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 使用SmtpClient發(fā)送郵件的方法

    使用SmtpClient發(fā)送郵件的方法

    本來(lái)想試試用SmtpClient來(lái)做一個(gè)簡(jiǎn)單的發(fā)送郵件的Demo程序。卻不想在中途遇上了意料之外的事情,使得這次試驗(yàn)過(guò)程變得有些曲折。
    2013-03-03
  • 聊一聊C#接口問(wèn)題 新手速來(lái)圍觀

    聊一聊C#接口問(wèn)題 新手速來(lái)圍觀

    聊一聊C#接口問(wèn)題,新手速來(lái)圍觀,一個(gè)通俗易懂的例子幫助大家更好的理解C#接口問(wèn)題,感興趣的小伙伴們可以參考一下
    2016-08-08
  • 使用HttpHanlder處理404:File not found的問(wèn)題

    使用HttpHanlder處理404:File not found的問(wèn)題

    本篇文章小編為大家介紹。使用HttpHanlder處理404:File not found的問(wèn)題。需要的朋友參考下
    2013-04-04
  • 淺析C#?AsyncLocal如何實(shí)現(xiàn)Thread間傳值

    淺析C#?AsyncLocal如何實(shí)現(xiàn)Thread間傳值

    這篇文章主要是來(lái)和大家一起討論一下C#?AsyncLocal如何實(shí)現(xiàn)Thread間傳值,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-01-01
  • unity通過(guò)Mesh網(wǎng)格繪制圖形球體

    unity通過(guò)Mesh網(wǎng)格繪制圖形球體

    這篇文章主要為大家詳細(xì)介紹了unity通過(guò)Mesh網(wǎng)格繪制圖形球體,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-11-11
  • c# 實(shí)現(xiàn)MD5,SHA1,SHA256,SHA512等常用加密算法源代碼

    c# 實(shí)現(xiàn)MD5,SHA1,SHA256,SHA512等常用加密算法源代碼

    c# 如何實(shí)現(xiàn)MD5,SHA1,SHA256,SHA512等常用加密算法,需要的朋友可以參考下
    2012-12-12
  • 使用C# 調(diào)用deepseek api接口實(shí)現(xiàn)正常訪問(wèn)的過(guò)程

    使用C# 調(diào)用deepseek api接口實(shí)現(xiàn)正常訪問(wèn)的過(guò)程

    本文介紹了使用C#調(diào)用deepseek API接口實(shí)現(xiàn)正常訪問(wèn)的方法,包括解決SSL/TLS安全通道問(wèn)題和切換模型等常見(jiàn)問(wèn)題,并提供了默認(rèn)使用的reasoner模型和賬戶余額信息,感興趣的朋友一起看看吧
    2025-02-02
  • 淺談C#中[]的幾種用法

    淺談C#中[]的幾種用法

    本文主要介紹了淺談C#中[]的幾種用法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • 原生實(shí)現(xiàn)C#與Lua相互調(diào)用方法(Unity3D可用)

    原生實(shí)現(xiàn)C#與Lua相互調(diào)用方法(Unity3D可用)

    Lua是一種很好的擴(kuò)展性語(yǔ)言,Lua解釋器被設(shè)計(jì)成一個(gè)很容易嵌入到宿主程序的庫(kù),下面這篇文章主要給大家介紹了關(guān)于原生實(shí)現(xiàn)C#與Lua相互調(diào)用方法,Unity3D可用的相關(guān)資料,需要的朋友可以參考下
    2022-04-04
  • C#表達(dá)式樹(shù)講解

    C#表達(dá)式樹(shù)講解

    本文詳細(xì)講解了C#表達(dá)式樹(shù)的創(chuàng)建、生成和使用,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-01-01

最新評(píng)論