Cascader selectValue not setting value

First, I want to acknowledge a 11/23 post on the same (or similar) issue. This post helped in that I was able to use the same accepted solution structure, populate my cascader, and I can even use the default value of the cascader to specify a selected entry - and this works.

However, I'm really struggling to programmatically select a specific value in my cascader.

I have 2 DB queries:

  • getItems - this is cached for 5 minutes, and queries for the cascader list items and uses a transformer to format the result appropriately. The resulting data populates the cascader, and the structure looks like the following:
[
  {
    "value": 1,
    "label": "Group 1",
    "children": [
      {
        "value": 1,
        "label": "Subgroup 1"
      }
    ]
  },
  {
    "value": 3,
    "label": "Group 2",
    "children": [
      {
        "value": 3,
        "label": "Subgroup 2"
      },
      {
        "value": 244,
        "label": "Subgroup 3"
      }
    ]
  }
]
  • getUser retrieves a specific user profile which contains the preference for the selected item. It triggers a script on success
buyerCascader.setValue(getBuyers.data.lookup[getCustomer.data.buyer_id]);
  • getBuyers.data.lookup[getCustomer.data.buyer_id] results in the value [3,244] however it does not trigger the cascader to set the value. If I change the script to set the value using the values directly buyerCascader.setValue([3,244]) it results in the same - no value set.

If I use [3,244] directly as the default value for the cascader, it defaults fine.

Hoping to get some ideas on how to further debug this.

I'll guess that it'll be related to the cascader only playing nicely with strings and not integers - if I change your "value" properties to strings in the above data structure then it works.