You need to sign in to do that
Don't have an account?
VSK98
How can we display the nested JSON values in lightning:treegrid
Hi All,
How can we display the nested JSON values in lightning:treegrid. I am getting values from Apex to lightning when I checked the console.
Please find the attached screenshot.
Column names:
I have tried with Subcustomer__r & Subcustomer. also but no results.
Regards,
VSK98
How can we display the nested JSON values in lightning:treegrid. I am getting values from Apex to lightning when I checked the console.
Please find the attached screenshot.
Column names:
component.set('v.tablecolumns', [ {label: 'Group name', fieldName: 'group_name', type: 'text'}, {label: 'GroupId', fieldName: 'groupid', type: 'number'}, {label: 'CustomerId ', fieldName: 'Subcustomer.CustomerId ', type: 'text'}, {label: 'Name', fieldName: 'CustomerName ', type: 'url', typeAttributes: {label: { fieldName: 'CustomerName' }, target: '_blank'}}, {label: 'Street', fieldName: 'Subcustomer__r.Street', type: 'text'}, {label: 'City', fieldName: 'City', type: 'text'}, {label: 'Post Code', fieldName: 'postalcode', type: 'text'}, {label: 'Country', fieldName: 'Country', type: 'text'}, {label: 'No of Assets', fieldName: 'Assetcnt', type: 'text'}, ]);
I have tried with Subcustomer__r & Subcustomer. also but no results.
Regards,
VSK98
https://rajvakati.com/2018/04/15/usage-of-lightningtreegrid/
I am getting the format as same but the field names are different in each table. In your code, the fields names are same.
Regards,
VSK98
Lightning tree grid inherits from Lightning data table which has a limitation of accessing flattened data. In other words the dot notation doesnt work on lightning data table. You can't do a 'foo.bar.zz' to access the value. See this link (https://salesforce.stackexchange.com/questions/193273/winter-18-lightningdatatable-does-not-get-values-from-a-parent-record).