liquor-tree icon indicating copy to clipboard operation
liquor-tree copied to clipboard

How to access data coming from server without changing its structure?

Open egeersoz opened this issue 3 years ago • 1 comments

I have the following data:

"Conditions": [
      {
        "Values": [
          "test"
        ],
        "Operator": "Equals",
        "Condition Type": "Project Name Rule"
      },
      {
        "Values": [
          "flower"
        ],
        "Operator": "Contains",
        "Condition Type": "Project Description Rule"
      },
      {
        "Conjunction": true,
        "Conditions": [
          {
            "Values": [
              "test value"
            ],
            "Operator": "Does Not Contain",
            "Condition Type": "Project Description Rule"
          },
          {
            "Values": [
              "another test value"
            ],
            "Operator": "Does Not Equal",
            "Condition Type": "Project Name Rule"
          }
        ],
        "Condition Type": "Composite Rule"
      }
    ],
    "Condition Type": "Composite Rule"

I need to load this "as-is" into the tree, and then access each prop using, e.g. node.data.Operator or node.data.Values. Is this possible?

I'm not able to use computed properties in this scenario.

egeersoz avatar Mar 08 '21 16:03 egeersoz

In the tree options you can replace the data containers :

treeOptions: {
        propertyNames: {
           text: 'name',
           score: colorder,
           children: 'kids', ...
   }
}

xavsio4 avatar Apr 21 '21 15:04 xavsio4