Added a filter for filtering bindings

This commit is contained in:
Siteshwar Vashisht 2013-10-13 21:40:59 +05:30
parent 0ad6e6f459
commit 877a14c0b8
2 changed files with 22 additions and 1 deletions

View file

@ -17,6 +17,23 @@ fishconfig.filter("filterVariable", function() {
}
});
fishconfig.filter("filterBinding", function() {
return function(bindings, query) {
var result = []
if (bindings == undefined) return result;
if (query == null) { return bindings};
for(i=0; i<bindings.length; ++i) {
binding = bindings[i];
if (binding.command.indexOf(query) != -1) {
result.push(binding);
}
}
return result;
}
});
fishconfig.config(
["$routeProvider", function($routeProvider) {
$routeProvider

View file

@ -1,6 +1,10 @@
<div id="table_filter_container" style="display: block;">
<input id="table_filter_text_box" class="filter_text_box text_box_transient" placeholder="Filter" ng-model="query">
</div>
<table class="data_table">
<tbody>
<tr class="data_table_row" ng-repeat="binding in bindings">
<tr class="data_table_row" ng-repeat="binding in bindings | filterBinding:query">
<td class="data_table_cell no_overflow" style="text-align: right; padding-right: 30px;">{{ binding.command }}</td>
<td class="data_table_cell no_overflow" style="text-align: left; padding-right: 30px;">{{ binding.binding }}</td>
</tr>