How can we add empty row template for List or Library control

Hi Team,

The form we are customizing has a List or Library control and is connected to a SharePoint list as the data source. Would like to know whether there is an option to show an empty row template when there is no record to display? (like "No record(s) found!")

Thanks,
sj

Dear @sooraj,
You can try the following JavaScript:

fd.spRendered(function(){
  function isListOrLibraryEmpty(name){
    console.log(fd.control(name).widget.dataItems().length);
    if(fd.control(name).widget.dataItems().length == 0){
      var newRowContent = "<tr><td></td><td></td><td>No Data Found</td></tr>";
      $(fd.control(name).$el).find('.k-grid-content tbody').append(newRowContent);
    }
  }
  
  //run on form load
  fd.control('SPDataTable1').$on('ready', function(){
    isListOrLibraryEmpty('SPDataTable1');
  });
});

Thanks @Nikita_Kurguzov for the response.
I tried the code snippet you shared. But, it is not binding the empty row template.

On the ready event of the control I am applying the following filter:
//Filter the data
ctrl.filter = Custom filter condition;
ctrl.refresh();

I think this is removing the empty row template. Can you please provide your thoughts on this?

Thanks,
sj

Dear @sooraj,
There is a better way to do it actually, try this instead:

fd.spRendered(function(){  
  //run on form load
  fd.control('SPDataTable1').$on('ready', function(ctrl){
    ctrl.widget.setOptions({
      noRecords: {
        template: "No data available on current page."
      }
    });
  });
});