2016-11-11 11 views
0

uiグリッド列ヘッダーに入力ボックスの値を表示しようとしています。uiグリッド列ヘッダーから入力ボックス(フィルタボックス)値を取得する方法

私は、列ヘッダー内の複数の入力ボックスから値を取得する必要がある私自身のフィルタリング機能を使用しようとしています。う

function myCustomFilterFunction(term, value, row, column){ 
    //do something here 
} 

uiGrid:

$scope.gridOptions.columnDefs = [ 
    { 
    field: 'name', 
    displayName: 'Name', 
    headerCellTemplate: '<input type='text' &nbsp;disallow-spaces placeholder='Enter to Search' ng-model='testCol' id='Enter to Search'>, 
    filter: { 
     type: uiGridConstants.filter.INPUT, 
     condition: myCustomFilterFunction 
    }, 
]; 

をして、フィルタリング機能は、次のようになります。

$scope.gridOptions.columnDefs = [ 
    { 
     field: 'name', 
     displayName: 'Name', 
     headerCellTemplate: '<input type='text' &nbsp;disallow-spaces placeholder='Enter to Search' ng-model='testCol' id='Enter to Search'>}, 
]; 

enter image description here

+0

あなたは何を持っているのか、あなたの問題を解決しようとしていることを示すコードを追加できますか? disallow-spaces placeholder = '検索するには入力してください' ng-model = 'testCol' –

+0

$ scope.gridOptions.columnDefs = [ {field: 'name'、displayName: 'Name'、headerCellTemplate:}、 ]; – ashvanth48

+0

@ GuranjanSinghこんにちは、私は、ui-gridの入力ボックスの値を取得しようとしています – ashvanth48

答えて

0

あなたはこのようcolumnDefにカスタムフィルタを与えることができますこれまでにmyCustomFilterFunctionに電話をかけるフィルタ入力が変化すると、パラメータtermはあなたが探していたものです。これは入力ボックスに表示される値です。パラメータvalueは、現在の行の列の値を参照します。パラメータrowcolは、現在のrowEntitycolumnへのアクセスを提供します。

myCustomFilterFunctionは、boolenを返す必要があります。行の戻り値がtrueの場合、行は表示されず、そうでない場合は表示されます。

関連する問題