We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Multi level Stacked Headers

Hello,
     I want to make multi level Stacked Headers in tree grid like attached image.

Regards, 
M. Salah

Attachment: Capture_cbe6f094.rar

1 Reply

VN Vignesh Natarajan Syncfusion Team January 11, 2019 04:38 AM UTC

Hi Mohammed Salah, 

Thanks for using Syncfusion products. 

Query: “ I want to make multi level Stacked Headers in tree grid like attached image.” 

From your query, we understand that you need to render the TreeGrid with multi level stacked header. We have achieved your requirement by defining the columns inside another column.  

Refer the below code example 

var treeGridObj = new ej.treegrid.TreeGrid({ 
        dataSource: window.stackedData, 
        allowPaging: true, 
        childMapping: 'subtasks', 
        treeColumnIndex: 1, 
        pageSettings: { pageCount: 5 }, 
        columns: [ 
               { headerText:'Orders',textAlign:'Left', 
               columns:[ 
                { headerText: 'Order Details', textAlign: 'Center',  
                  columns: [ 
                        { field: 'orderID', headerText: 'Order ID', textAlign: 'Right', width: 90 }, 
                        { field: 'orderName', headerText: 'Order Name', textAlign: 'Left', width: 170 },                       
                    ] 
                }, 
                { 
                    headerText: 'Shipment Details', textAlign: 'Center', columns: [ 
                        { field: 'shipMentCategory', headerText: 'Shipment Category', textAlign: 'Left', width: 150 }, 
                        { field: 'shippedDate', headerText: 'Shipped Date', textAlign: 'Right', width: 120, format: 'yMd' }, 
                        { field: 'units', headerText: 'Units', textAlign: 'Left', width: 85 }, 
                    ] 
                }]}, 
                { headerText:'Pricing',textAlign:'Left', 
                columns:[ 
                { headerText: 'Price Details', textAlign: 'Center',  
                columns: [ 
                        { field: 'unitPrice', headerText: 'Price per unit', format: 'c2', type: 'number', width: 110, textAlign: 'Right' }, 
                        { field: 'price', headerText: 'Total Price', width: 110, format: 'c', type: 'number', textAlign: 'Right' } 
                    ] 
                } 
                ]} 
            ] 
    }); 
    treeGridObj.appendTo('#TreeGrid'); 
 

 
  
Refer the below screenshot for the output 

 
 
  
For your convenience we have prepared a sample which can be referred from below  


Please get back to us if you have further queries. 

Regards, 
Vignesh Natarajan 


Loader.
Live Chat Icon For mobile
Up arrow icon