在检查/取消检查树列表中的节点后如何中断
我有一个小问题。 我应该实现一个treeList 的逻辑,该逻辑由单个父级和按ID 分组为更多组的更多子级组成。
我有一个处理所有节点的操作:
long callerGroup = -1L;
if (callerNode != null)
{
var service = this.tlServices.GetDataRecordByNode(callerNode) as __ServiceInfo;
if (service != null)
{
callerGroup = service.Group;
}
}
Action<TreeListNodes> action = null;
action = (nodes) =>
{
if (nodes != null && nodes.Count > 0)
{
foreach (TreeListNode node in nodes)
{
if (node.Level == 0 && !node.Checked)
{
node.Checked = true;
break;
}
else
{
var service = this.tlServices.GetDataRecordByNode(node) as __ServiceInfo;
if (service != null)
{
var group = service.Group;
//for ' 1 <= group <= 100' -> Mandatory Service, only ONE from group
if (callerGroup >= 1 && callerGroup <= 100)
{
if (group >= 1 && group <= 100)
{
//node.Checked = true; - not done
}
}
//for ' 101 <= group <= 1000 ' -> Mandatory Service, minimum ONE from group, but allow and MORE
if (callerGroup >= 101 && callerGroup <= 1000)
{
}
//for ' group >= 1001 ' -> optional Service, ALL from group
if (callerGroup >= 1001 && group >= 1001)
{
node.Checked = !node.Checked; // --> DONE.
}
}
}
action(node.Nodes);
}
}
};
action(this.tlServices.Nodes);
我有 3 种情况:
- #1。 if 1 <= 组 <= 100 ->强制服务,仅允许
- 第 2 组中的一项。 if 101 <= 组 <= 1000 ->强制服务,至少允许团体中的一名,但允许更多
- #3。如果组>= 1001 ->可选服务,选中/取消选中组中的所有内容。
结果: #3 我已经做得很简单,但是我如何实现#1。
I have a little problem.
i should implement a logic for a treeList which consist from a single parent and more children grouped into more groups by ID's.
I have an action which treats all nodes:
long callerGroup = -1L;
if (callerNode != null)
{
var service = this.tlServices.GetDataRecordByNode(callerNode) as __ServiceInfo;
if (service != null)
{
callerGroup = service.Group;
}
}
Action<TreeListNodes> action = null;
action = (nodes) =>
{
if (nodes != null && nodes.Count > 0)
{
foreach (TreeListNode node in nodes)
{
if (node.Level == 0 && !node.Checked)
{
node.Checked = true;
break;
}
else
{
var service = this.tlServices.GetDataRecordByNode(node) as __ServiceInfo;
if (service != null)
{
var group = service.Group;
//for ' 1 <= group <= 100' -> Mandatory Service, only ONE from group
if (callerGroup >= 1 && callerGroup <= 100)
{
if (group >= 1 && group <= 100)
{
//node.Checked = true; - not done
}
}
//for ' 101 <= group <= 1000 ' -> Mandatory Service, minimum ONE from group, but allow and MORE
if (callerGroup >= 101 && callerGroup <= 1000)
{
}
//for ' group >= 1001 ' -> optional Service, ALL from group
if (callerGroup >= 1001 && group >= 1001)
{
node.Checked = !node.Checked; // --> DONE.
}
}
}
action(node.Nodes);
}
}
};
action(this.tlServices.Nodes);
I have 3 cases:
- #1. if 1 <= group <= 100 -> Mandatory Service, allow only ONE from group
- #2. if 101 <= group <= 1000 -> Mandatory Service, allow minimum ONE from group, but allow and MORE
- #3. if group >= 1001 -> optional Service, Check/ Uncheck ALL from group.
Result:
The #3 I've done easy, but how can i implement #1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于#1,我找到了一个实现:
//for ' 1 <= group <= 100' ->强制服务,团体中仅限一项
for #1 i found an implementation:
//for ' 1 <= group <= 100' -> Mandatory Service, only ONE from group