I think it may be because the node selected is the status nodes, not the checkbox nodes
Those are not nodes, those are columns (usually bound by field name). A node can contain any number of columns.
Further, this line of code ensures your operation is running across all nodes:
NodesIterator.DoOperation(operation);
The code below is based on an educated guess about your data source or code that populates the TreeList
(if unbound) from the screenshot.
Code:
public class MatchStatusOps : TreeListOperation
{
private readonly string fieldName;
private readonly string status;
private readonly string checkboxFieldName;
public MatchStatusOps(string fieldName, string status, string checkboxFieldName)
{
this.fieldName = fieldName;
this.status = status;
this.checkboxFieldName = checkboxFieldName;
}
public override void Execute(TreeListNode node)
{
String statusValue = Convert.ToString(node[fieldName]);
if (statusValue.Equals(status))
node[checkboxFieldName] = true;
}
}
Usage:
var operation = new MatchStatusOps("Status","Active","YourCheckboxFieldName");
NodesIterator.DoOperation(operation);
Note I'm setting a column on a given node to checked, not the node itself.
Confirmed working on my end with latest DevExpress version as of this writing.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…