GUI -- Bug fixes - TableModel displays empty cell instead of causing NPE if no value is given. Sort icons and direction are reset when view is destroyed.

Change-Id: Ib56527e4d523fabf846ffb9f948a6ead99280a4b
diff --git a/core/api/src/main/java/org/onosproject/ui/table/TableModel.java b/core/api/src/main/java/org/onosproject/ui/table/TableModel.java
index fd6095b..d0fccb6 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/TableModel.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/TableModel.java
@@ -246,7 +246,6 @@
          * @return self, for chaining
          */
         public Row cell(String columnId, Object value) {
-            checkNotNull(value, "Must supply some value");
             checkId(columnId);
             cells.put(columnId, value);
             return this;
diff --git a/core/api/src/test/java/org/onosproject/ui/table/TableModelTest.java b/core/api/src/test/java/org/onosproject/ui/table/TableModelTest.java
index 77326ce..7524bcb 100644
--- a/core/api/src/test/java/org/onosproject/ui/table/TableModelTest.java
+++ b/core/api/src/test/java/org/onosproject/ui/table/TableModelTest.java
@@ -112,12 +112,6 @@
         tm.addRow().cell(ZOO, 2);
     }
 
-    @Test(expected = NullPointerException.class)
-    public void rowNullValue() {
-        tm = new TableModel(FOO, BAR);
-        tm.addRow().cell(FOO, null);
-    }
-
     @Test
     public void simpleRow() {
         tm = new TableModel(FOO, BAR);
diff --git a/web/gui/src/main/webapp/app/fw/widget/table.js b/web/gui/src/main/webapp/app/fw/widget/table.js
index b4b1e4c..b2e1cc8 100644
--- a/web/gui/src/main/webapp/app/fw/widget/table.js
+++ b/web/gui/src/main/webapp/app/fw/widget/table.js
@@ -133,7 +133,7 @@
         };
     }
 
-    function resetSortIcons() {
+    function resetSort() {
         if (currCol.div) {
             sortIconAPI.sortNone(currCol.div);
         }
@@ -219,7 +219,7 @@
                 sortIconAPI = is.sortIcons();
 
                 return {
-                    resetSortIcons: resetSortIcons
+                    resetSort: resetSort
                 };
         }]);
 
diff --git a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
index 611e371..ef3fd66 100644
--- a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
@@ -63,7 +63,7 @@
 
         function refresh() {
             $log.debug('Refreshing ' + root + ' page');
-            ts.resetSortIcons();
+            ts.resetSort();
             sortCb();
         }
         o.scope.refresh = refresh;
@@ -74,6 +74,7 @@
         // Cleanup on destroyed scope
         o.scope.$on('$destroy', function () {
             wss.unbindHandlers(handlers);
+            ts.resetSort();
         });
 
         sortCb();