Creating Stores and using Observables
Change-Id: I214692e64df065beaddee0e0ec8759de540c269d
diff --git a/src/app/core/table/table.scss b/src/app/core/table/table.scss
new file mode 100644
index 0000000..fbf6ee7
--- /dev/null
+++ b/src/app/core/table/table.scss
@@ -0,0 +1,41 @@
+table {
+ width: 100%;
+ max-width: 100%;
+ margin-bottom: 20px;
+ border-collapse: collapse !important;
+ background: darken(grey, 20);
+ border: 1px solid darken(grey, 35);
+
+ td, th {
+ }
+ > tbody > tr > th,
+ > tfoot > tr > th,
+ > thead > tr > td,
+ > tbody > tr > td,
+ > tfoot > tr > td {
+ padding: 8px;
+ line-height: 1.42857143;
+ vertical-align: top;
+ border-top: 1px solid #ddd;
+ }
+ > thead > tr > th {
+ vertical-align: bottom;
+ border-bottom: 2px solid #ddd;
+ text-align: left;
+ padding: 8px;
+ }
+ > caption + thead > tr:first-child > th,
+ > colgroup + thead > tr:first-child > th,
+ > thead:first-child > tr:first-child > th,
+ > caption + thead > tr:first-child > td,
+ > colgroup + thead > tr:first-child > td,
+ > thead:first-child > tr:first-child > td {
+ border-top: 0;
+ }
+ > tbody + tbody {
+ border-top: 2px solid #ddd;
+ }
+ .table .table {
+ background-color: #fff;
+ }
+}
\ No newline at end of file
diff --git a/src/app/core/table/table.ts b/src/app/core/table/table.ts
index 43360c6..a837600 100644
--- a/src/app/core/table/table.ts
+++ b/src/app/core/table/table.ts
@@ -1,6 +1,7 @@
// TODO fininsh to import all methods from https://github.com/opencord/ng-xos-lib/blob/master/src/ui_components/dumbComponents/table/table.component.js
// TODO import tests
+import './table.scss';
import * as _ from 'lodash';
interface IXosTableCgfOrder {
@@ -19,8 +20,6 @@
public columns: any[];
public orderBy: string;
public reverse: boolean;
-
- private data: any[];
private config: IXosTableCfg;
@@ -34,13 +33,13 @@
}
// handle default ordering
- if (this.config.order && angular.isObject(this.config.order)){
+ if (this.config.order && angular.isObject(this.config.order)) {
this.reverse = this.config.order.reverse || false;
this.orderBy = this.config.order.field || 'id';
}
// if columns with type 'custom' are provided
- // check that a custom formatte3 is provided too
+ // check that a custom formatter is provided too
let customCols = _.filter(this.config.columns, {type: 'custom'});
if (angular.isArray(customCols) && customCols.length > 0) {
_.forEach(customCols, (col) => {
@@ -51,7 +50,7 @@
}
// if columns with type 'icon' are provided
- // check that a custom formatte3 is provided too
+ // check that a custom formatter is provided too
let iconCols = _.filter(this.config.columns, {type: 'icon'});
if (angular.isArray(iconCols) && iconCols.length > 0) {
_.forEach(iconCols, (col) => {