簡體   English   中英

AG GRID-> Angular 中的超級搜索

[英]Super Search in AG GRID-> Angular

我正在使用 AG 網格。 TextFilter 工作正常。 但我希望我的 ag 網格在我用逗號分隔的字符串(“,”)進行搜索時顯示行。 例如:當我用 "abc,def,xyz" 搜索時,它應該給出行包含 abc 或 def 或 xyz 的結果。

提前致謝

看看使用textCustomComparator選項,記錄在這里: https : textCustomComparator

以下是如何實現的示例:

filterParams: {
  filterOptions: ["contains"],
  textCustomComparator: function(filter, value, filterText) {
    // get array of comma separated values
    const filterValues = filterText.split(',');
    // loop through filterValues and see if the value contains any of them
    return filterValues.some((item) => {
      return value.indexOf(item) >= 0;
    });
  }
}

另一種選擇是使用自定義過濾器,此處記錄: https : //www.ag-grid.com/javascript-grid-filter-custom/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM