Skip to content

Commit

Permalink
make searching case insensitive by default with option to change
Browse files Browse the repository at this point in the history
  • Loading branch information
aldeed committed Dec 10, 2014
1 parent 2369191 commit 9f3638d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions client/tabular.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ Template.tabular.rendered = function () {
var skip = data.start,
limit = data.length,
searchString = data.search && data.search.value,
caseInsensitive = tabularTable.options && tabularTable.options.search && tabularTable.options.search.caseInsensitive,
currentSelector = _.clone(selector),
sort;

if (searchString) {
var searches = _.map(searchFields, function(field) {
var m = {};
m[field] = {$regex: searchString};
// DataTables searches are case insensitive by default
if (caseInsensitive !== false) {
m[field]["$options"] = "-i";
}
return m;
});
if (searches.length) {
Expand Down
4 changes: 2 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package.describe({
name: 'aldeed:tabular',
summary: 'Datatables for large or small datasets in Meteor',
version: '0.2.1',
version: '0.2.2',
git: 'https://github.com/aldeed/meteor-tabular.git'
});

Package.onUse(function(api) {
api.versionsFrom(['METEOR@0.9.4']);
api.versionsFrom(['METEOR@0.9.4', 'METEOR@1.0']);
api.use(['check', 'underscore', 'mongo', 'blaze', 'templating']);

api.export('Tabular');
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@
]
],
"pluginDependencies": [],
"toolVersion": "meteor-tool@1.0.35",
"toolVersion": "meteor-tool@1.0.36",
"format": "1.0"
}

0 comments on commit 9f3638d

Please sign in to comment.