jQuery MiniUI

标题: mini-tree动态设置Url [打印本页]

作者: Aisin丿Gioro    时间: 2020-1-2 09:02:47     标题: mini-tree动态设置Url

mini-tree怎么动态设置URL并且传值,URL请求回的数据是下面那种格式的,
var list = [
                { id: "base", text: "Base" },            
                { id: "ajax", text: "Ajax", pid: "base" },
                { id: "json", text: "JSON", pid: "base" },
                { id: "date", text: "Date", pid: "base" },
                { id: "control", text: "Control", pid: "base" },
                { id: "forms", text: "Forms", pid: "base" },
                { id: "button", text: "Button", pid: "forms" },
                { id: "listbox", text: "ListBox", pid: "forms" },
                { id: "checkboxlist", text: "CheckBoxList", pid: "forms" },
            { id: "lists", text: "Lists" },
                { id: "datagrid", text: "DataGrid", pid: "lists" },
                { id: "tree", text: "Tree", pid: "lists" },
                { id: "treegrid", text: "TreeGrid ", pid: "lists" }
        ];


作者: felt    时间: 2020-1-2 09:31:55

tree.setUrl(url)
tree.setResutAsTree(false);
作者: Aisin丿Gioro    时间: 2020-1-2 09:37:00

本帖最后由 Aisin丿Gioro 于 2020-1-2 09:49 编辑
felt 发表于 2020-1-2 09:31
tree.setUrl(url)
tree.setResutAsTree(false);

好的谢谢
作者: Aisin丿Gioro    时间: 2020-1-2 09:56:25

本帖最后由 Aisin丿Gioro 于 2020-1-2 10:08 编辑
felt 发表于 2020-1-2 09:31
tree.setUrl(url)
tree.setResutAsTree(false);

为什么我加载出来的树节点无限循环,点击一次树节点请求一次url
  tree.setAjaxOptions({
                type:'post',
                async: true,
                data: {
                    parentCode: moduleId
                },
                dataType: 'json',
                contentType: 'application/x-www-form-urlencoded;charset=utf-8'
            });
            tree.setResultAsTree(true);
            tree.setUrl("${pageContext.request.contextPath }/channel/selectChannelChildByCode");
作者: felt    时间: 2020-1-2 10:22:33

Aisin丿Gioro 发表于 2020-1-2 09:56
为什么我加载出来的树节点无限循环,点击一次树节点请求一次url
  tree.setAjaxOptions({
                 ...

贴一下树的数据
作者: Aisin丿Gioro    时间: 2020-1-2 10:45:51

felt 发表于 2020-1-2 10:22
贴一下树的数据

[{"isStatic":"off","code":"n2","flag":"","icon":"","description":"","pid":"c1","type":"1","isLeaf":"false","path":"","expanded":"false","pagesize":"20","alias":"简称","id":"2","RSiteId":"","sort":10,"url":"http://baidu.com","target":"open","createBy":"11","createTime":"","deleteTime":"","name":"栏目1","deleteBy":"","isDel":0,"onoff":"on"},{"isStatic":"off","code":"n3","flag":"","icon":"","description":"","pid":"c1","type":"1","isLeaf":"true","path":"","expanded":"false","pagesize":"20","alias":"简称","id":"3","RSiteId":"","sort":11,"url":"http://baidu.com","target":"open","createBy":"11","createTime":"","deleteTime":"","name":"栏目2","deleteBy":"","isDel":0,"onoff":"on"}]
作者: felt    时间: 2020-1-2 13:35:12

Aisin丿Gioro 发表于 2020-1-2 10:45
[{"isStatic":"off","code":"n2","flag":"","icon":"","description":"","pid":"c1","type":"1","isLeaf" ...

isLeaf:false     那么强制这个节点是父节点,如果不需要懒加载,那么给这个节点设置asyncload:false
作者: Aisin丿Gioro    时间: 2020-1-2 14:23:43

felt 发表于 2020-1-2 13:35
isLeaf:false     那么强制这个节点是父节点,如果不需要懒加载,那么给这个节点设置asyncload:false ...

我的就是懒加载的,而且还得点击有子节点的父节点,去请求接口每次点击都需要懒加载都得传不同的参数。
作者: felt    时间: 2020-1-2 14:47:37

Aisin丿Gioro 发表于 2020-1-2 14:23
我的就是懒加载的,而且还得点击有子节点的父节点,去请求接口每次点击都需要懒加载都得传不同的参数。 ...

懒加载的我们传递了当前节点的id到后台,请后台按节点id进行处理




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2