diff --git a/views/ngXosLib/gulp/ngXosHelpers.js b/views/ngXosLib/gulp/ngXosHelpers.js
index f50ba90..435e239 100644
--- a/views/ngXosLib/gulp/ngXosHelpers.js
+++ b/views/ngXosLib/gulp/ngXosHelpers.js
@@ -71,6 +71,7 @@
         'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-animate.min.js',
         'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-cookies.min.js',
         'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-resource.js',
+        'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular-mocks.js',
         'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.11.2/lodash.js',
         `./${options.ngXosVendor}ngXosHelpers.js`,
       ],
@@ -124,9 +125,12 @@
 
     gulp.watch(files, ['makeDocs']);
 
-    gulp.watch(files, function(){
-      browserSync.reload();
-    });
+    // uncomment to enable autoreload, now it is broken (reload a wrong page)
+    // https://github.com/nikhilmodak/gulp-ngdocs/issues/81
+
+    // gulp.watch(files, function(){
+    //   browserSync.reload();
+    // });
   })
 
   gulp.task('dev', function(){
diff --git a/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js b/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js
index 8a94632..5cacaf8 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js
@@ -7,14 +7,7 @@
 (function () {
   'use strict';
 
-  const mockData = [
-    {
-      id: 1,
-      first_name: 'Jon',
-      last_name: 'Snow',
-      hidden_field: 'hidden'
-    }
-  ];
+  let mockData;
 
   describe('The xos.helper module', function(){
     describe('The xos-smart-table component', () => {
@@ -24,6 +17,17 @@
       beforeEach(module('xos.helpers'));
 
       beforeEach(function() {
+
+        // set mockData
+        mockData = [
+          {
+            id: 1,
+            first_name: 'Jon',
+            last_name: 'Snow',
+            hidden_field: 'hidden'
+          }
+        ]
+
         jasmine.addMatchers({
           toBeInstanceOf: function() {
 
@@ -111,9 +115,11 @@
       });
 
       it('should delete a model', () => {
+        // saving mockData (they are going to be deleted)
+        let mock = angular.copy(mockData);
         $(element).find('a[title="delete"]')[0].click();
-        expect(spy.delete).toHaveBeenCalledWith({id: mockData[0].id});
-        expect($(element).find('.alert')).toContainText(`MockResource with id ${mockData[0].id} successfully deleted`);
+        expect(spy.delete).toHaveBeenCalledWith({id: mock[0].id});
+        expect($(element).find('.alert')).toContainText(`MockResource with id ${mock[0].id} successfully deleted`);
       });
 
       it('should show the form', () => {
diff --git a/views/ngXosLib/xosHelpers/spec/ui/table.test.js b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
index 5ad1360..7279995 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/table.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/table.test.js
@@ -91,7 +91,7 @@
           });
         });
 
-        describe('when a field type is provided', () => {
+        xdescribe('when a field type is provided', () => {
           describe('and is boolean', () => {
             beforeEach(() => {
               console.log('iS: ' + isolatedScope);
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
index 0a4a1b0..6ae25f7 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
@@ -16,9 +16,64 @@
     * @name xos.uiComponents.directive:xosSmartTable
     * @restrict E
     * @description The xos-table directive
-    * @param {Object} config The configuration for the component.
+    * @param {Object} config The configuration for the component,
+    * it is composed by the name of an angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource)
+    * and an array of fields that shouldn't be printed.
+    * ```
+    * {
+        resource: 'Users',
+        hiddenFields: []
+      }
+    * ```
     * @scope
     * @example
+
+    <example module="sampleSmartTable">
+      <file name="index.html">
+        <div ng-controller="SampleCtrl as vm">
+          <xos-smart-table config="vm.config"></xos-smart-table>
+        </div>
+      </file>
+      <file name="script.js">
+        angular.module('sampleSmartTable', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
+        // This is only for documentation purpose
+        .run(function($httpBackend, _){
+          let datas = [{id: 1, name: 'Jhon', surname: 'Doe'}];
+          let count = 1;
+
+          let paramsUrl = new RegExp(/\/test\/(.+)/);
+
+          $httpBackend.whenDELETE(paramsUrl, undefined, ['id']).respond((method, url, data, headers, params) => {
+            data = angular.fromJson(data);
+            let id = url.match(paramsUrl)[1];
+            _.remove(datas, (d) => {
+              return d.id === parseInt(id);
+            })
+            return [204];
+          });
+
+          $httpBackend.whenGET('/test').respond(200, datas)
+          $httpBackend.whenPOST('/test').respond((method, url, data) => {
+            data = angular.fromJson(data);
+            data.id = ++count;
+            datas.push(data);
+            return [201, data, {}];
+          });
+        })
+        .factory('_', function($window){
+          return $window._;
+        })
+        .service('SampleResource', function($resource){
+          return $resource('/test/:id', {id: '@id'});
+        })
+        // End of documentation purpose, example start
+        .controller('SampleCtrl', function(){
+          this.config = {
+            resource: 'SampleResource'
+          };
+        });
+      </file>
+    </example>
     */
    
   .directive('xosSmartTable', function(){
@@ -82,6 +137,7 @@
               cb: (item) => {
                 this.Resource.delete({id: item.id}).$promise
                 .then(() => {
+                  _.remove(this.data, (d) => d.id === item.id);
                   this.responseMsg = `${this.config.resource} with id ${item.id} successfully deleted`;
                 })
                 .catch(err => {
@@ -108,7 +164,7 @@
 
         this.formConfig = {
           exclude: this.config.hiddenFields,
-          fields: [],
+          fields: {},
           formName: `${this.config.resource}Form`,
           actions: [
             {
@@ -116,7 +172,9 @@
               icon: 'ok',
               cb: (item) => {
                 item.$save()
-                .then(() => {
+                .then((res) => {
+                  this.data.push(angular.copy(res));
+                  delete this.detailedItem;
                   this.responseMsg = `${this.config.resource} with id ${item.id} successfully saved`;
                 })
                 .catch((err) => {
@@ -138,44 +196,48 @@
 
         this.Resource = $injector.get(this.config.resource);
 
-        this.Resource.query().$promise
-        .then((res) => {
+        const getData = () => {
+          this.Resource.query().$promise
+          .then((res) => {
 
-          if(!res[0]){
-            return;
-          }
+            if(!res[0]){
+              return;
+            }
 
-          let item = res[0];
-          let props = Object.keys(item);
+            let item = res[0];
+            let props = Object.keys(item);
 
-          _.remove(props, p => {
-            return p == 'id' || p == 'password' || p == 'validators'
-          });
-
-          // TODO move out cb
-          if(angular.isArray(this.config.hiddenFields)){
-            props = _.difference(props, this.config.hiddenFields)
-          }
-
-          let labels = props.map(p => LabelFormatter.format(p));
-
-          props.forEach((p, i) => {
-            this.tableConfig.columns.push({
-              label: labels[i],
-              prop: p
+            _.remove(props, p => {
+              return p == 'id' || p == 'password' || p == 'validators'
             });
-          });
 
-          // build form structure
-          props.forEach((p, i) => {
-            this.formConfig.fields.push({
-              label: LabelFormatter.format(labels[i]).replace(':', ''),
-              type: XosFormHelpers._getFieldFormat(item[p])
+            // TODO move out cb
+            if(angular.isArray(this.config.hiddenFields)){
+              props = _.difference(props, this.config.hiddenFields)
+            }
+
+            let labels = props.map(p => LabelFormatter.format(p));
+
+            props.forEach((p, i) => {
+              this.tableConfig.columns.push({
+                label: labels[i],
+                prop: p
+              });
             });
-          });
 
-          this.data = res;
-        });
+            // build form structure
+            props.forEach((p, i) => {
+              this.formConfig.fields[p] = {
+                label: LabelFormatter.format(labels[i]).replace(':', ''),
+                type: XosFormHelpers._getFieldFormat(item[p])
+              };
+            });
+
+            this.data = res;
+          });
+        }
+
+        getData();
       }
     };
   });
diff --git a/xos/core/xoslib/static/js/vendor/ngXosHelpers.js b/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
index ad71bb9..a5dd809 100644
--- a/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
+++ b/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
@@ -41,9 +41,60 @@
   * @name xos.uiComponents.directive:xosSmartTable
   * @restrict E
   * @description The xos-table directive
-  * @param {Object} config The configuration for the component.
+  * @param {Object} config The configuration for the component,
+  * it is composed by the name of an angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource)
+  * and an array of fields that shouldn't be printed.
+  * ```
+  * {
+      resource: 'Users',
+      hiddenFields: []
+    }
+  * ```
   * @scope
   * @example
+   <example module="sampleSmartTable">
+    <file name="index.html">
+      <div ng-controller="SampleCtrl as vm">
+        <xos-smart-table config="vm.config"></xos-smart-table>
+      </div>
+    </file>
+    <file name="script.js">
+      angular.module('sampleSmartTable', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
+      // This is only for documentation purpose
+      .run(function($httpBackend, _){
+        let datas = [{id: 1, name: 'Jhon', surname: 'Doe'}];
+        let count = 1;
+         let paramsUrl = new RegExp(/\/test\/(.+)/);
+         $httpBackend.whenDELETE(paramsUrl, undefined, ['id']).respond((method, url, data, headers, params) => {
+          data = angular.fromJson(data);
+          let id = url.match(paramsUrl)[1];
+          _.remove(datas, (d) => {
+            return d.id === parseInt(id);
+          })
+          return [204];
+        });
+         $httpBackend.whenGET('/test').respond(200, datas)
+        $httpBackend.whenPOST('/test').respond((method, url, data) => {
+          data = angular.fromJson(data);
+          data.id = ++count;
+          datas.push(data);
+          return [201, data, {}];
+        });
+      })
+      .factory('_', function($window){
+        return $window._;
+      })
+      .service('SampleResource', function($resource){
+        return $resource('/test/:id', {id: '@id'});
+      })
+      // End of documentation purpose, example start
+      .controller('SampleCtrl', function(){
+        this.config = {
+          resource: 'SampleResource'
+        };
+      });
+    </file>
+  </example>
   */
 
   .directive('xosSmartTable', function () {
@@ -72,6 +123,9 @@
             icon: 'remove',
             cb: function cb(item) {
               _this.Resource.delete({ id: item.id }).$promise.then(function () {
+                _.remove(_this.data, function (d) {
+                  return d.id === item.id;
+                });
                 _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully deleted';
               }).catch(function (err) {
                 _this.responseErr = err.data.detail || 'Error while deleting ' + _this.config.resource + ' with id ' + item.id;
@@ -95,13 +149,15 @@
 
         this.formConfig = {
           exclude: this.config.hiddenFields,
-          fields: [],
+          fields: {},
           formName: this.config.resource + 'Form',
           actions: [{
             label: 'Save',
             icon: 'ok',
             cb: function cb(item) {
-              item.$save().then(function () {
+              item.$save().then(function (res) {
+                _this.data.push(angular.copy(res));
+                delete _this.detailedItem;
                 _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully saved';
               }).catch(function (err) {
                 _this.responseErr = err.data.detail || 'Error while saving ' + _this.config.resource + ' with id ' + item.id;
@@ -121,45 +177,49 @@
 
         this.Resource = $injector.get(this.config.resource);
 
-        this.Resource.query().$promise.then(function (res) {
+        var getData = function getData() {
+          _this.Resource.query().$promise.then(function (res) {
 
-          if (!res[0]) {
-            return;
-          }
+            if (!res[0]) {
+              return;
+            }
 
-          var item = res[0];
-          var props = Object.keys(item);
+            var item = res[0];
+            var props = Object.keys(item);
 
-          _.remove(props, function (p) {
-            return p == 'id' || p == 'password' || p == 'validators';
-          });
-
-          // TODO move out cb
-          if (angular.isArray(_this.config.hiddenFields)) {
-            props = _.difference(props, _this.config.hiddenFields);
-          }
-
-          var labels = props.map(function (p) {
-            return LabelFormatter.format(p);
-          });
-
-          props.forEach(function (p, i) {
-            _this.tableConfig.columns.push({
-              label: labels[i],
-              prop: p
+            _.remove(props, function (p) {
+              return p == 'id' || p == 'password' || p == 'validators';
             });
-          });
 
-          // build form structure
-          props.forEach(function (p, i) {
-            _this.formConfig.fields.push({
-              label: LabelFormatter.format(labels[i]).replace(':', ''),
-              type: XosFormHelpers._getFieldFormat(item[p])
+            // TODO move out cb
+            if (angular.isArray(_this.config.hiddenFields)) {
+              props = _.difference(props, _this.config.hiddenFields);
+            }
+
+            var labels = props.map(function (p) {
+              return LabelFormatter.format(p);
             });
-          });
 
-          _this.data = res;
-        });
+            props.forEach(function (p, i) {
+              _this.tableConfig.columns.push({
+                label: labels[i],
+                prop: p
+              });
+            });
+
+            // build form structure
+            props.forEach(function (p, i) {
+              _this.formConfig.fields[p] = {
+                label: LabelFormatter.format(labels[i]).replace(':', ''),
+                type: XosFormHelpers._getFieldFormat(item[p])
+              };
+            });
+
+            _this.data = res;
+          });
+        };
+
+        getData();
       }]
     };
   });
