Added default order and icon formatter to xosTable component
diff --git a/views/ngXosLib/xosHelpers/spec/ui/table.test.js b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
index d00d19e..9247cae 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/table.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
@@ -287,6 +287,52 @@
               expect($(td1).text().trim()).toEqual('Formatted Content');
             });
           });
+
+          describe('and is icon', () => {
+
+            beforeEach(() => {
+              scope.config = {
+                columns: [
+                  {
+                    label: 'Label 1',
+                    prop: 'label-1',
+                    type: 'icon',
+                    formatter: item => {
+                      switch (item['label-1']){
+                        case 1:
+                          return 'ok';
+                        case 2:
+                          return 'remove';
+                        case 3:
+                          return 'plus'
+                      }
+                    }
+                  }
+                ]
+              };
+              scope.data = [
+                {
+                  'label-1': 1
+                },
+                {
+                  'label-1': 2
+                },
+                {
+                  'label-1': 3
+                }
+              ];
+              compileElement();
+            });
+
+            it('should render a custom icon', () => {
+              let td1 = $(element).find('tbody tr:first-child td')[0];
+              let td2 = $(element).find('tbody tr:nth-child(2) td')[0];
+              let td3 = $(element).find('tbody tr:last-child td')[0];
+              expect($(td1).find('i')).toHaveClass('glyphicon-ok');
+              expect($(td2).find('i')).toHaveClass('glyphicon-remove');
+              expect($(td3).find('i')).toHaveClass('glyphicon-plus');
+            });
+          });
         });
 
         describe('when a link property is provided', () => {
@@ -421,6 +467,23 @@
             expect(arrows.length).toEqual(4);
           });
 
+          describe('and a default ordering is passed', () => {
+
+            beforeEach(() => {
+              scope.config.order = {
+                field: 'label-1',
+                reverse: true
+              };
+              compileElement();
+            });
+
+            it('should orderBy the default order', () => {
+              var tr = $(element).find('tr');
+              expect($(tr[1]).text()).toContain('Sample 2.2');
+              expect($(tr[2]).text()).toContain('Sample 1.1');
+            });
+          });
+
           describe('and an order is set', () => {
             beforeEach(() => {
               isolatedScope.orderBy = 'label-1';
@@ -429,6 +492,7 @@
             });
 
             it('should orderBy', function() {
+              // console.log($(element).find('table'));
               var tr = $(element).find('tr');
               expect($(tr[1]).text()).toContain('Sample 2.2');
               expect($(tr[2]).text()).toContain('Sample 1.1');
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 8b49932..0e28a19 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
@@ -385,7 +385,11 @@
                       </dl>
                     </span>
                     <span ng-if="col.type === 'custom'">
-                      {{col.formatter(item[col.prop])}}
+                      {{col.formatter(item)}}
+                    </span>
+                    <span ng-if="col.type === 'icon'">
+                      <i class="glyphicon glyphicon-{{col.formatter(item)}}">
+                      </i>
                     </span>
                   </td>
                   <td ng-if="vm.config.actions">
@@ -426,8 +430,14 @@
             throw new Error('[xosTable] Please provide a columns list in the configuration');
           }
 
-          // if columns with type 'custom' are provide
-          // check that a custom formatted is provided too
+          // handle default ordering
+          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
           let customCols = _.filter(this.config.columns, {type: 'custom'});
           if(angular.isArray(customCols) && customCols.length > 0){
             _.forEach(customCols, (col) => {
@@ -437,6 +447,17 @@
             })
           }
 
+          // if columns with type 'icon' are provided
+          // check that a custom formatte3 is provided too
+          let iconCols = _.filter(this.config.columns, {type: 'icon'});
+          if(angular.isArray(iconCols) && iconCols.length > 0){
+            _.forEach(iconCols, (col) => {
+              if(!col.formatter || !angular.isFunction(col.formatter)){
+                throw new Error('[xosTable] You have provided an icon field type, a formatter function should provided too.');
+              }
+            })
+          }
+
           // if a link property is passed,
           // it should be a function
           let linkedColumns = _.filter(this.config.columns, col => angular.isDefined(col.link));