2017-06-06 19 views
0

我是新來的角,所以請接受我的道歉,如果它的基本問題。 我有一個網格定義,它從數據庫中獲取行數據。我正在嘗試在網格上方放置搜索欄,以在其上應用其他免費文本過濾器。網格上已經有列過濾器。任何幫助將非常感激。我正在使用這裏是我的代碼[ag-grid]:網格上方的自由文本過濾器/搜索欄

<input class"search" placeholder="Search..." type="text" ng-model="search-model" ng-change="$ctrl.onFilterChanged(this.search)"/> 


onFilterChanged(value){ 
    this.gridOptions.api.setQuickFilter(value); 
    } 

我也看過外部過濾器,但我不能實現它作爲自由文本。我真的很掙扎。請幫助我。非常感謝。

回答

0

以下是我最後工作的解決方案:

<input type="text" ng-model="$ctrl.gridOptions.quickFilterText" placeholder="Type text to filter..." class="toolbarFilterTextBox" 

在控制器中,在colDef從你的HTML添加一個字段getQuickFilterText:<some data renderer function>

叫它

1

這是錯誤的ng模型。正確的值是:

<input class"search" placeholder="Search..." type="text" ng-model="search" ng-change="$ctrl.onFilterChanged(this.search)"/>