extjs - 如何在 Extjs 中的树存储数据中添加新根作为现有节点的父节点
问题描述
我正在研究一个树组合框(组合框内的树面板),我有一个树存储来加载树组合框。
我想提供全选功能,所以想添加一个新的根,它将成为现有树存储数据的父级。
树店:
var store = new Ext.data.TreeStore({
root: {
expanded: true,
children: [
{ text: "Numbers", expanded: false, children: [
{ text: '1', leaf: true },
{ text: '2', leaf: true },
{ text: '3', leaf: true },
{ text: '4', leaf: true },
{ text: '5', leaf: true },
] },
{ text: "Letters", expanded: true, children: [
{ text: 'A', leaf: true },
{ text: 'B', leaf: true },
{ text: 'C', leaf: true },
{ text: 'D', leaf: true },
{ text: 'E', leaf: true },
] },
{ text: "Colors", expanded: false, children: [
{ text: 'Red', leaf: true },
{ text: 'Green', leaf: true },
{ text: 'Blue', leaf: true }
] }
]
}
});
解决方案
推荐阅读
- django - 如何获取当前用户的 slug?
- javascript - 我可以在渲染时使用捆绑的 Javascript 文件操作 popup.html DOM 吗?
- python - 使用烧瓶中sqlalchemy的create_engine创建的引擎连接()时出现内存错误
- asp.net-mvc - 为什么 .NET Core Web API 调用 AddMVC() 和 UseMVC()?
- jquery - 如何仅显示最近的 i 元素?
- javascript - 显示带有数据信息的标记弹出窗口
- python - Pandas Dataframe 的困难嵌套字典
- java - 如何管理自定义处理器所需的外部 jar 依赖项
- java - Base64 无法解析 (Java 1.7)
- sql - 使用 for 循环获取所有字符串值