You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by co...@apache.org on 2016/06/09 08:11:19 UTC

incubator-zeppelin git commit: [ZEPPELIN-973, ZEPPELIN-954] Table rendering improvements

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master c4f4b31f0 -> e6a44d8cc


[ZEPPELIN-973, ZEPPELIN-954] Table rendering improvements

### What is this PR for?
This PR fixes a few minor issues from the recent introduction of Handsontable for table rendering (https://github.com/apache/incubator-zeppelin/pull/858):
* Render up to 5 digits after decimal point instead of always rounding to integers
* Allow visual selection of table cells (for copy)
* Default to text renderer instead of numeric renderer

### What type of PR is it?
Bug Fix, Improvement

### Todos

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-973
* https://issues.apache.org/jira/browse/ZEPPELIN-954

### How should this be tested?
Output some rows with floating point numbers and render them in a table.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Hao Xia <ha...@optimizely.com>

Closes #973 from jasonxh/hao/render-table and squashes the following commits:

a663833 [Hao Xia] Remove cell selection. Allow visually selecting table text.
7bc85b5 [Hao Xia] Table rendering improvements: * Render up to 5 digits after decimal point * Allow visual selection of table cells * Default to text renderer


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/e6a44d8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/e6a44d8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/e6a44d8c

Branch: refs/heads/master
Commit: e6a44d8cca7042defc995fc78f981e47e3dd018d
Parents: c4f4b31
Author: Hao Xia <ha...@optimizely.com>
Authored: Wed Jun 8 00:16:26 2016 -0700
Committer: Damien CORNEAU <co...@gmail.com>
Committed: Thu Jun 9 17:11:08 2016 +0900

----------------------------------------------------------------------
 .../notebook/paragraph/paragraph.controller.js  | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/e6a44d8c/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index c819565..da17ed7 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -1241,20 +1241,21 @@ angular.module('zeppelinWebApp')
         manualRowResize: true,
         editor: false,
         fillHandle: false,
+        fragmentSelection: true,
         disableVisualSelection: true,
         cells: function (row, col, prop) {
           var cellProperties = {};
-            cellProperties.renderer = function(instance, td, row, col, prop, value, cellProperties) {
-              Handsontable.NumericCell.renderer.apply(this, arguments);
-              if (!isNaN(value)) {
-                cellProperties.type = 'numeric';
-                cellProperties.format = '0,0';
-                cellProperties.editor = false;
-                td.style.textAlign = 'left';
-              } else if (value.length > '%html'.length && '%html ' === value.substring(0, '%html '.length)) {
-                td.innerHTML = value.substring('%html'.length);
-              }
-            };
+          cellProperties.renderer = function(instance, td, row, col, prop, value, cellProperties) {
+            if (!isNaN(value)) {
+              cellProperties.format = '0,0.[00000]';
+              td.style.textAlign = 'left';
+              Handsontable.renderers.NumericRenderer.apply(this, arguments);
+            } else if (value.length > '%html'.length && '%html ' === value.substring(0, '%html '.length)) {
+              td.innerHTML = value.substring('%html'.length);
+            } else {
+              Handsontable.renderers.TextRenderer.apply(this, arguments);
+            }
+          };
           return cellProperties;
         }
       });