Hi Daniel,
Greetings from Syncfusion Support!
The TreeGrid component currently does not include a built-in emptyRecordTemplate property like the Grid component. However, you can achieve similar functionality by dynamically customizing the empty record template using either localization or by modifying the empty record template in the TreeGrid's load event.
Suggested Solution:
To display a customized empty record template before the data loads, you can implement it by setting the template in load event of treegrid.
Refer the below code snippet:
//Load event
function load() {
var instance = document.getElementsByClassName('e-treegrid')[0].ej2_instances[0];
instance.grid.emptyRecordTemplate = '#emptytemplate'; //update emptyrecord template
}
//HTML and CSS for the Empty Record Template:
.emptyRecordTemplate {
text-align: center;
}
.e-emptyRecord {
display: block;
margin: 10px auto;
}
</style>
<script id="emptytemplate" type="text/x-template">
<div class='emptyRecordTemplate'>
<img src="emptyRecordTemplate.svg" class="e-emptyRecord" alt="No record">
<span>There is no data available to display at the moment.</span>
</div>
</script>
|
Please make sure to use the id="emptytemplate" in the <script> tag in your index.js file as shown above.
This logic can be seamlessly integrated into your application's lifecycle to dynamically update the empty record template as needed.
Please review the sample, and let us know if you have any further questions or need additional assistance.
Best regards,
Sreedhar Kumar.