Skip to content

Commit

Permalink
build and update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzofox3 committed Mar 10, 2015
2 parents 5b5e0dd + 8717f71 commit 5c53ef2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-smart-table",
"version": "1.4.13",
"version": "2.0.0",
"homepage": "https://github.com/lorenzofox3/Smart-Table",
"authors": [
"lorenzofox3 <[email protected]>"
Expand Down
5 changes: 5 additions & 0 deletions changeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,8 @@ function(tableState, tableController){
* use a global configuration
* expose filtered collection result

## version 2.0.0

* use interpolation rather than binding for st-search directive (to avoid the creation of isolated scope)

**This is a breaking change as now, you will have to remove the single quote around the predicate property name, and if you were using a binding, you'll have to interpolate it with the curly brace notation**
15 changes: 7 additions & 8 deletions dist/smart-table.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/smart-table.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-smart-table",
"version": "1.4.13",
"version": "2.0.0",
"description": "",
"main": "dist/smart-table.js",
"scripts": {
Expand Down
11 changes: 5 additions & 6 deletions src/stSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ ng.module('smart-table')
.directive('stSearch', ['stConfig', '$timeout', function (stConfig, $timeout) {
return {
require: '^stTable',
scope: {
predicate: '=?stSearch'
},
link: function (scope, element, attr, ctrl) {
var tableCtrl = ctrl;
var promise = null;
var throttle = attr.stDelay || stConfig.search.delay;

scope.$watch('predicate', function (newValue, oldValue) {

attr.$observe('stSearch', function (newValue, oldValue) {
if (newValue !== oldValue) {
ctrl.tableState().search = {};
tableCtrl.search(element[0].value || '', newValue);
Expand All @@ -21,7 +19,7 @@ ng.module('smart-table')
scope.$watch(function () {
return ctrl.tableState().search;
}, function (newValue, oldValue) {
var predicateExpression = scope.predicate || '$';
var predicateExpression = attr.stSearch || '$';
if (newValue.predicateObject && newValue.predicateObject[predicateExpression] !== element[0].value) {
element[0].value = newValue.predicateObject[predicateExpression] || '';
}
Expand All @@ -33,8 +31,9 @@ ng.module('smart-table')
if (promise !== null) {
$timeout.cancel(promise);
}

promise = $timeout(function () {
tableCtrl.search(evt.target.value, scope.predicate || '');
tableCtrl.search(evt.target.value, attr.stSearch || '');
promise = null;
}, throttle);
});
Expand Down
4 changes: 2 additions & 2 deletions test/spec/stSearch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('stSearch Directive', function () {
var template = '<table st-table="rowCollection">' +
'<thead>' +
'<tr>' +
'<th><input st-search="\'name\'" /></th>' +
'<th><input st-search="name" /></th>' +
'<th><input st-search="" /></th>' +
'<th>age</th>' +
'</tr>' +
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('stSearch Directive', function () {
var template = '<table st-table="rowCollection">' +
'<thead>' +
'<tr>' +
'<th><input st-search="searchPredicate" /></th>' +
'<th><input st-search="{{searchPredicate}}" /></th>' +
'<th><input st-search="" /></th>' +
'<th>age</th>' +
'</tr>' +
Expand Down

0 comments on commit 5c53ef2

Please sign in to comment.