一、節(jié)點模糊搜索功能:搜索成功后,自動高亮顯示并定位、展開搜索到的節(jié)點。
永興網站建設公司成都創(chuàng)新互聯公司,永興網站設計制作,有大型網站制作公司豐富經驗。已為永興上千多家提供企業(yè)網站建設服務。企業(yè)網站搭建\成都外貿網站建設公司要多少錢,請找那個售后服務好的永興做網站的公司定做!
二、節(jié)點異步加載:1、點擊展開時加載數據;2、選中節(jié)點時加載數據。
前臺代碼如下:
js:
html:
后臺代碼(后臺返回Json數據):
public void SelStudent() { set("getStudentsJsonUrl", to(GetStudentsJson)); } public void GetStudentsJson() { List> dicList = new List >(); string level = ctx.Post("level"); string id = ctx.Post("id"); if (strUtil.IsNullOrEmpty(id)) { #region 加載班級 //獲取當前登錄用戶 Sys_User user = AdminSecurityUtils.GetLoginUser(ctx); //獲取當前用戶關聯的老師 Edu_Teacher teacher = edu_TeacService.FindByUserId(user.Id); //獲取班級集合 List list = edu_ClaNameFlowService.GetListByTeacherId(teacher.Id); foreach (Edu_ClaNameFlow item in list) { Dictionary dic = new Dictionary (); dic.Add("id", "level0" + item.Calss.Id.ToString()); dic.Add("pId", "0"); dic.Add("name", item.Gra.Name + item.Calss.Name); dic.Add("isParent", "true"); dicList.Add(dic); } #endregion } else { if (level == "0") { //加載學生 List list = edu_StudService.GetListByClassId(id.Replace("level0", "")); foreach (Edu_Student item in list) { Dictionary dic = new Dictionary (); dic.Add("id", "level1" + item.Id.ToString()); dic.Add("pId", id); dic.Add("name", item.Name); dic.Add("isParent", "false"); dicList.Add(dic); } } } echoJson(dicList); }
更多關于ztree控件的內容,請參考專題《jQuery插件ztree使用匯總》 。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持創(chuàng)新互聯。