You need to sign in to do that
Don't have an account?
Chris Mair
Querying 4 levels for Lightning:TreeGrid
Hi All,
I'm trying to implement Lightning:TreeGrid with 4 levels of record hierarchy. I've successfully implemented TreeGrid with two levels which is very simple to achieve with a single query. However I'm not sure how to approach getting 4 levels GreatGrandParent, GrandParent, Parent, Child. I have Master Detail on these objects using fields of the same api name with roll up summaries so if I can get the data to come back I think this will work really well to show totals and grand totals.
I know I probably need to use wrapper classes but I don't know how to get started as I'm more a declarative developer.
Thanks!
Chris
I'm trying to implement Lightning:TreeGrid with 4 levels of record hierarchy. I've successfully implemented TreeGrid with two levels which is very simple to achieve with a single query. However I'm not sure how to approach getting 4 levels GreatGrandParent, GrandParent, Parent, Child. I have Master Detail on these objects using fields of the same api name with roll up summaries so if I can get the data to come back I think this will work really well to show totals and grand totals.
I know I probably need to use wrapper classes but I don't know how to get started as I'm more a declarative developer.
Thanks!
Chris
Refer this links
https://rajvakati.com/2018/05/10/usage-of-lightningtree/
https://rajvakati.com/2018/04/15/usage-of-lightningtreegrid/
Your documentation is excellent. I can't thank you enough for sharing this with the community. I was able to get this working using your example, however the last level displays a chevron even though there is nothing to show. Is it an issue with how I'm querying? The code below works aside from that issue. Thanks again for your response!
List<AccountWrapper> aooo = new List<AccountWrapper>();
for(Revenue_Call_Great_Grandparent__c a : accs){
AccountWrapper aWraper = new AccountWrapper() ;
aWraper.name =a.Name ;
aWraper.label =a.Name ;
List<Items> co = new List<Items>();
for(Revenue_Call_Grandparent__c c : a.RevenueCallGrandparents__r){
Items conWrapp = new Items();
conWrapp.name =c.Name ;
conWrapp.label =c.Name ;
List<Items> wrapperOooo = new List<Items>();
for(Revenue_Call_Parent__c o : opps.get(c.Id).RevenueCallParents__r){
Items ooo = new Items();
ooo.name = o.Name ;
ooo.label = o.Name ;
wrapperOooo.add(ooo);
List<Items> wrapperFooo = new List<Items>();
for(RevenueCallData__c o2 : opps2.get(o.Id).RevenueCallDatas__r){
Items ooo2 = new Items();
ooo2.name = o2.Name ;
ooo2.label = o2.Name ;
wrapperFooo.add(ooo2);
}
ooo.items =wrapperFooo ;
//wrapperOooo.add(ooo);
}
conWrapp.items =wrapperOooo ;
co.add(conWrapp);
}
aWraper.items = co;
aooo.add(aWraper);
}
@Raj Vakati, it appears your website may have gone down as a I am seeing "There has been a critical error on your website." when loading your links.