Added boolean filter to xosTable
diff --git a/views/ngXosLib/xosHelpers/spec/ui/table.test.js b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
index 69dadb3..f87eb96 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/table.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
@@ -144,6 +144,20 @@
expect($(td1).find('i')).toHaveClass('glyphicon-ok');
expect($(td2).find('i')).toHaveClass('glyphicon-remove');
});
+
+ describe('with field filters', () => {
+ beforeEach(() => {
+ scope.config.filter = 'field';
+ compileElement();
+ });
+
+ it('should render a dropdown for filtering', () => {
+ let td1 = $(element).find('table tbody tr td')[0];
+ console.log(td1);
+ expect(td1).toContainElement('select');
+ expect(td1).not.toContainElement('input');
+ });
+ });
});
describe('and is date', () => {
@@ -304,12 +318,12 @@
type: 'icon',
formatter: item => {
switch (item['label-1']){
- case 1:
- return 'ok';
- case 2:
- return 'remove';
- case 3:
- return 'plus'
+ case 1:
+ return 'ok';
+ case 2:
+ return 'remove';
+ case 3:
+ return 'plus'
}
}
}
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
index a42f3a4..04671ba 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
@@ -369,10 +369,19 @@
<tr>
<td ng-repeat="col in vm.columns">
<input
+ ng-if="col.type !== 'boolean'"
class="form-control"
placeholder="Type to search by {{col.label}}"
type="text"
ng-model="vm.query[col.prop]"/>
+ <select
+ ng-if="col.type === 'boolean'"
+ class="form-control"
+ ng-model="vm.query[col.prop]">
+ <option value="">-</option>
+ <option value="true">True</option>
+ <option value="false">False</option>
+ </select>
</td>
<td ng-if="vm.config.actions"></td>
</tr>
diff --git a/views/ngXosViews/serviceGrid/env/default.js b/views/ngXosViews/serviceGrid/env/default.js
index 07017a6..c93b55c 100644
--- a/views/ngXosViews/serviceGrid/env/default.js
+++ b/views/ngXosViews/serviceGrid/env/default.js
@@ -8,6 +8,6 @@
module.exports = {
host: 'http://xos.dev:9999/',
- xoscsrftoken: '528Q93KwEJn88ET6TZipc1gsc7qjhaTz',
- xossessionid: '8ij3xax15jxwr3abkwohkczwrfivfbzk'
+ xoscsrftoken: 'QVWEAqnNKBLT7pzsjpgiL10eGSKeCxxN',
+ xossessionid: 'qrb3fxh8uz3abxjy59w8uccpm6u2twa8'
};
diff --git a/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html b/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html
index 26f7281..fa324b4 100644
--- a/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html
+++ b/views/ngXosViews/serviceGrid/src/templates/service-grid.tpl.html
@@ -1,8 +1,8 @@
<div class="row">
- <div class="col-sm-10">
+ <div class="col-md-10 table-responsive">
<xos-table config="vm.tableConfig" data="vm.services"></xos-table>
</div>
- <div class="col-sm-2">
+ <div class="col-md-2">
<a href="/admin/core/service/add" class="btn btn-success btn-block">
<i class="glyphicon glyphicon-plus"></i>
Add Service