jQuery MiniUI

 找回密码
 立即注册
查看: 1770|回复: 3
打印 上一主题 下一主题

frame1框架获取左侧列表问题 [复制链接]

Rank: 6Rank: 6

跳转到指定楼层
楼主
发表于 2019-5-8 21:19:52 |只看该作者 |倒序浏览
示例中看到列表的json格式,子菜单是通过children:方式实现
能不能和grid一样,使用id=xx   pid=xx的方式让它们层级对应上?

Rank: 8Rank: 8

沙发
发表于 2019-5-9 09:12:53 |只看该作者
这导航只是一个简单的html,js,css效果,没有那么复杂的功能。我们开放了源代码,可以自行扩展完善。
可以使用mini.arrayToTree(data,"children","id","pid")方法把列表数据转成树形数据

Rank: 6Rank: 6

板凳
发表于 2019-5-9 10:19:40 |只看该作者
dforce 发表于 2019-5-9 09:12
这导航只是一个简单的html,js,css效果,没有那么复杂的功能。我们开放了源代码,可以自行扩展完善。
可以使 ...

你这个arraytoTree方法.

第一个参数 data 是json字符串,还是json数组对象?

另外第2,3,4参数的意义能说一下吗?

Rank: 8Rank: 8

地板
发表于 2019-5-9 11:14:19 |只看该作者
nbakill2 发表于 2019-5-9 10:19
你这个arraytoTree方法.

第一个参数 data 是json字符串,还是json数组对象?

var data=[]      //id,pid对应关系的列表形态数组
var treeData=mini.arrayToTree(data,"children","id","pid");
//children   生成的树形数据里面,带出子节点的字段
//id,pid      列表数据里面形成对应关系的字段
  1. var data = [
  2.                 { id: "base", text: "Base" },
  3.                 { id: "ajax", text: "Ajax", pid: "base" },
  4.                 { id: "json", text: "JSON", pid: "base" },
  5.                 { id: "date", text: "Date", pid: "base" },
  6.                 { id: "control", text: "Control", pid: "base" },
  7.                 { id: "forms", text: "Forms", pid: "base" },
  8.                 { id: "button", text: "Button", pid: "forms" },
  9.                 { id: "listbox", text: "ListBox", pid: "forms" },
  10.                 { id: "checkboxlist", text: "CheckBoxList", pid: "forms" },
  11.             { id: "lists", text: "Lists" },
  12.                 { id: "datagrid", text: "DataGrid", pid: "lists" },
  13.                 { id: "tree", text: "Tree", pid: "lists" },
  14.                 { id: "treegrid", text: "TreeGrid ", pid: "lists" }
  15.         ];
  16.     var treeData = mini.arrayToTree(data, "children", "id", "pid")
  17.    
  18.     [{
  19.         "id": "base",
  20.         "text": "Base",
  21.         "children": [{
  22.             "id": "ajax",
  23.             "text": "Ajax",
  24.             "pid": "base"
  25.         },
  26.     {
  27.         "id": "json",
  28.         "text": "JSON",
  29.         "pid": "base"
  30.     },
  31.     {
  32.         "id": "date",
  33.         "text": "Date",
  34.         "pid": "base"
  35.     },
  36.     {
  37.         "id": "control",
  38.         "text": "Control",
  39.         "pid": "base"
  40.     },
  41.     {
  42.         "id": "forms",
  43.         "text": "Forms",
  44.         "pid": "base",
  45.         "children": [{
  46.             "id": "button",
  47.             "text": "Button",
  48.             "pid": "forms"
  49.         },
  50.         {
  51.             "id": "listbox",
  52.             "text": "ListBox",
  53.             "pid": "forms"
  54.         },
  55.         {
  56.             "id": "checkboxlist",
  57.             "text": "CheckBoxList",
  58.             "pid": "forms"
  59.         }]
  60.     }]
  61.     },
  62. {
  63.     "id": "lists",
  64.     "text": "Lists",
  65.     "children": [{
  66.         "id": "datagrid",
  67.         "text": "DataGrid",
  68.         "pid": "lists"
  69.     },
  70.     {
  71.         "id": "tree",
  72.         "text": "Tree",
  73.         "pid": "lists"
  74.     },
  75.     {
  76.         "id": "treegrid",
  77.         "text": "TreeGrid ",
  78.         "pid": "lists"
  79.     }]
  80. }]
复制代码

Archiver|普加软件

GMT+8, 2024-6-26 17:12 , Processed in 1.068339 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部