arrays - 从 Angularjs 中的 Array 对象创建二叉树
问题描述
我有一个数组对象,它显示为带有输入控件和值的行。此值根据对象值状态 true 或 false 显示,如下面的示例链接所示。一旦根据数组值生成表,同时选择/取消选择复选框,二进制选择应该发生,并且需要更新到新数组中,如帖子“输出应该是。这里是工作样本。这是可以实现的智能方式吗?
Actual scenario is the following, needs to convert binary tree based on "show" true value.
{ Row: "1",
RowValues: [
{td:"1", show: true},
{td:"2", show: true},
{td:"3", show: true},
{td:"4", show: true},
{td:"5", show: true}
]
},
{ Row: "2",
RowValues: [
{td:"6", show: false},
{td:"7", show: false},
{td:"8", show: false},
{td:"9", show: true},
{td:"10", show: false}
]
},
{ Row: "3",
RowValues: [
{td:"11", show: false},
{td:"12", show: false},
{td:"13", show: true},
{td:"14", show: true}
]
},
{ Row: "4",
RowValues: [
{td:"15", show: false},
{td:"16", show: false},
{td:"17", show: false},
{td:"18", show: true}
]
}
]
Scenario is
1 2 3 4 5
9
13 14
18
while selecting the node 18
**output should be** [1,2,13,18]
Scenario is
1 2 3 4 5
9
13 14
18
while selecting the node 3
**output should be** [1,2,3,4, 5,9]
解决方案
推荐阅读
- javascript - javascript中的用户输入日期验证
- printing - 从visual basic 6打印excel表
- stata - 从解到对偶的反算原始解(线性规划,Stata)
- r - 根据来自另一个数据框的多列向数据框添加新列
- node.js - Node + Mongoose:填充 ref 对象数组
- javascript - 循环遍历 id 和 fire 函数
- java - Groovy - 使用 JJWT 生成 JWT 令牌
- c++ - 在 C++ 中,为什么即使我编写了移动构造函数,Test(Test{}) 或 Test((Test())) 也只调用一次默认 ctor?
- keystonejs - Keystone js动态选择字段
- pip - 所有软件包都安装在新的 python venv 中