angular - no data found not working in filter ag grid - Stack Overflow

I'm using AG Grid in my Angular project and trying to filter the data using quickFilterText. If th

I'm using AG Grid in my Angular project and trying to filter the data using quickFilterText. If there are no matching rows, I want to display a "No Data Found" message. However, the AG Grid method showNoRowsOverlay() doesn't seem to be working as expected.

Here’s my current implementation:

onFilterTextBoxChanged(event: Event) {

    this.gridApi.setGridOption(
      "quickFilterText",
      (document.getElementById("filter-text-box") as HTMLInputElement).value,
    );    
      if (this.gridApi.getDisplayedRowCount() === 0) {  
        this.gridApi.showNoRowsOverlay(); 
        
      } else {
        this.gridApi.setGridOption('rowData', this.rowData);
      }       

}

Even when no rows match the filter, the "No Rows" overlay does not appear. What could be the issue? Is there a better approach to achieve this functionality?

Any help would be appreciated!

I'm using AG Grid in my Angular project and trying to filter the data using quickFilterText. If there are no matching rows, I want to display a "No Data Found" message. However, the AG Grid method showNoRowsOverlay() doesn't seem to be working as expected.

Here’s my current implementation:

onFilterTextBoxChanged(event: Event) {

    this.gridApi.setGridOption(
      "quickFilterText",
      (document.getElementById("filter-text-box") as HTMLInputElement).value,
    );    
      if (this.gridApi.getDisplayedRowCount() === 0) {  
        this.gridApi.showNoRowsOverlay(); 
        
      } else {
        this.gridApi.setGridOption('rowData', this.rowData);
      }       

}

Even when no rows match the filter, the "No Rows" overlay does not appear. What could be the issue? Is there a better approach to achieve this functionality?

Any help would be appreciated!

Share Improve this question asked Mar 14 at 13:05 Maa Henna Art by SaksheeMaa Henna Art by Sakshee 191 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

My guess is that you will need to separate your code.

Showing the no rows message should be checked/displayed AFTER the filter has beend applied.

https://www.ag-grid/angular-data-grid/grid-events/#reference-filter-filterChanged

filterChanged = (params: any): void => {
  if (this.gridApi.getDisplayedRowCount() === 0) {  
    this.gridApi.showNoRowsOverlay(); 
  }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744655005a4586127.html

相关推荐

  • angular - no data found not working in filter ag grid - Stack Overflow

    I'm using AG Grid in my Angular project and trying to filter the data using quickFilterText. If th

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>