DropdownTree - Self-referential data with data manager

I'm trying to figure out how I can use datamanager and self-referential data. The documentation appears to be pretty sparse on that.

I have a multi-level object like

[{

"data": [
      { "id"1"name""A" },
      {
        "id"2,
        "name""B",
        "children": [
          { "id"3"name""B1" },
          {
            "id"4,
            "name""B2",
            "children": [
              { "id"5"name""B2.1"},
              { "id"6"name""B2.2" },
              { "id"7"name""B2,3" },
              { "id"8"name""B2.4" },
            ]
          },
"id"99"name""C" },

If I use the fields property with this json as static data it works fine:

fields: {
    dataSource: someLocalData.data,
    value: 'id',
    text: 'name',
    child: 'children',
  }

Now I have created a service that returns this same structure, wrapped into "result" and "count", for the dataManager.

The documented example only has 2 levels of query; how do I configure the query to work with self-referential data please?


2 Replies 1 reply marked as answer

ST Stefan January 3, 2024 12:35 PM UTC

Never mind. I followed the instructions and wrapped the result from the API into result and count properties. If I don't do that it's actually working fine.


Marked as answer

SS Shereen Shajahan Syncfusion Team January 4, 2024 05:15 AM UTC

Hi Stefan,

Thank you for the update. Please get back to us for assistance in the future.

Regards,

Shereen


Loader.
Up arrow icon