Skip to main content
I am using a lightning tree grid in my component. Expand and collapse was absolutely working fine with 30+ records, but when it comes to 1500+ records expand and collapse is not working properly. It is throwing these errors:-  Cannot read property 'Symbol(ViewModel)' of undefined and Cannot read property 'setAttribute' of undefined, While trying to collapse or collapse all after using expand all. Can anyone suggest any solution for this problem?
1 risposta
  1. 19 giu 2019, 11:27
    Hi Vineeth,

    Greetings to you!

    If you have a large number of nested items that would delay the loading of your data, consider loading your nested items asynchronously. The nested items are displayed only when you expand the particular row. To do so, initialize your data without nested items.

     

    var mydata = [

    {

    "name": "123556-A",

    "accountName": "Acme Corporation (Bay Area)",

    :

    :

    "_children": []

    }, //more data

    ];

    Define the nested items separately.

    childrenData: {

    "123556-A": [

    {

    "name": "123556-A-A",

    "accountName": "Acme Corporation (Oakland)",

    :

    :

    },

    {

    "name": "123556-A-B",

    "accountName": "Acme Corporation (San Francisco)",

    :

    :

    }

    ],

    Handle asynchronous loading of nested items when a row is expanded using the ontoggle action. Find the name of the row being expanded and check if data for the nested items are already available before retrieving and displaying the nested items.

    ({

    handleRowToggle: function(cmp, event, helper) {

    var rowName = event.getParam('name');

    var hasChildrenContent = event.getParam('hasChildrenContent');

    if (!hasChildrenContent) {

    // Retrieve and display the nested items

    // by passing in the original data, row name, and data for the nested items

    }

    }

    })

    Please refer to the below link for more information:

    https://developer.salesforce.com/docs/component-library/bundle/lightning:treeGrid/documentation

    I hope it helps you.

    Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

    Thanks and Regards,

    Khan Anas
0/9000