Starting in 2019, the Reporting control is no longer included in Essential Studio®. If you're experiencing issues with the Syncfusion� Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion� and appreciate your understanding.

Force empty rows up to max 20 if datasource has less than 20 rows

Hi,

Is it possible to force my grid to show up to a max of 20 empty rows even if the datasource has less than 20 rows?

I am using ajax to populate the grid with data and sometimes, the number of rows are less than 20.


3 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team November 30, 2021 11:22 AM UTC

Hi Eddie, 
 
Greetings from Syncfusion support. 
 
Based on the query we would like to let you know that, by default the Grid initializes and renders row values based on the data present in the dataSource property. So your requirement of rendering empty rows if the data length is less than 20 can be achieved by pushing empty object value to the Grid’s dataSource property. This can be done in its load event as demonstrated in the below code snippet, 
 
// Grid’s load event handler 
function onLoad() { 
    var grid = document.getElementById('Grid').ej2_instances[0];  
    var dataLen = grid.dataSource.length; 
    while(dataLen < 20) { 
        // Condition executes when Grid data length is less that ‘20’ 
        // Empty object is pushed to the Grid’s data source to render empty row 
        grid.dataSource.push({}); 
        dataLen = grid.dataSource.length; 
    } 
} 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 


Marked as answer

EW Eddie Willcox replied to Sujith Kumar Rajkumar November 30, 2021 11:43 AM UTC

Thank you. This is exactly what I was looking for



SK Sujith Kumar Rajkumar Syncfusion Team December 1, 2021 09:19 AM UTC

Hi Eddie, 
 
You’re welcome. We are glad to hear that your query has been resolved. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon