• change all tree node check status to true/false

    Example

    import { changeAllCheck } from "tree-handle-lib";
    const node = [
    {
    id: 1,
    label: "Parent 1",
    checked: false,
    halfChecked: false,
    children: [
    {
    id: 11,
    label: "Child 11",
    checked: false,
    halfChecked: false,
    children: [],
    },
    {
    id: 12,
    label: "Child 12",
    checked: false,
    halfChecked: false,
    children: [],
    },
    ],
    },
    ];
    const _node = changeAllCheck(node, true);
    // [
    // {
    // id: 1,
    // label: "Parent 1",
    // checked: true,
    // halfChecked: false,
    // children: [
    // {
    // id: 11,
    // label: "Child 11",
    // checked: true,
    // halfChecked: false,
    // children: [],
    // },
    // {
    // id: 12,
    // label: "Child 12",
    // checked: true,
    // halfChecked: false,
    // children: [],
    // },
    // ],
    // },
    // ];

    Parameters

    • node: TNode

      the root node of the tree, can be a single node or an array of nodes

    • checkedValue: boolean = true

      change the tree node check status to true/false, default value is true

    • checkedName: string = CHECKED_NAME

      the checked name of the node in the tree structure, default value is CHECKED_NAME='checked'

    • halfCheckedName: string = HALF_CHECKED_NAME

      the halfChecked name of the node in the tree structure, default value is HALF_CHECKED_NAME='halfChecked'

    • childrenName: string = CHILDREN_NAME

      the child key name of the child node in the tree structure, default value is CHILDREN_NAME='children'

    Returns TNode

    node | null

Generated using TypeDoc