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

ej.grids.Grid Render just column headers with null data

Is it possible to render a grid's (ej.grids.Grid) column headers when the datasource is null?

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team July 25, 2019 11:20 AM UTC

Hi Travis, 

Greetings from Syncfusion support. 

Yes, we can set the column headertext value when the dataSource as null. 

Refer the below code example. 


var grid = new ej.grids.Grid({ 
    dataSource: null, 
    columns: [ 
        { field: 'OrderID', headerText: 'Order ID', width: 120, textAlign: 'Right' }, 
        { field: 'CustomerName', headerText: 'Customer Name', width: 150 }, 
        { field: 'OrderDate', headerText: 'Order Date', width: 130, format: 'yMd', textAlign: 'Right' }, 
        { field: 'Freight', width: 120, format: 'C2', textAlign: 'Right' }, 
        { field: 'ShippedDate', headerText: 'Shipped Date', width: 140, format: 'yMd', textAlign: 'Right' }, 
        { field: 'ShipCountry', headerText: 'Ship Country', width: 150 } 
    ] 
}); 
grid.appendTo('#Grid'); 


We have prepared a simple sample in the following link. 


Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon