From 78130f1884d8ee7e55d0c19578c5088de2a34bba Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 21 Sep 2016 16:22:47 +0300 Subject: Migrate AbstractJavaScriptRenderer to the new Grid (#182). Change-Id: Ic514875fab8d90484b3a73b073bcc9d53697de75 --- .../com/vaadin/tests/components/grid/myBeanJsRenderer.js | 7 +++++-- .../v7/tests/components/grid/JavaScriptStringRenderer.js | 5 +++++ .../vaadin/v7/tests/components/grid/myBeanJsRenderer.js | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 uitest/src/main/resources/com/vaadin/v7/tests/components/grid/JavaScriptStringRenderer.js create mode 100644 uitest/src/main/resources/com/vaadin/v7/tests/components/grid/myBeanJsRenderer.js (limited to 'uitest/src/main/resources') diff --git a/uitest/src/main/resources/com/vaadin/tests/components/grid/myBeanJsRenderer.js b/uitest/src/main/resources/com/vaadin/tests/components/grid/myBeanJsRenderer.js index 5e7bde5ec7..9beeabb677 100644 --- a/uitest/src/main/resources/com/vaadin/tests/components/grid/myBeanJsRenderer.js +++ b/uitest/src/main/resources/com/vaadin/tests/components/grid/myBeanJsRenderer.js @@ -4,13 +4,16 @@ window.com_vaadin_tests_components_grid_MyBeanJSRenderer = function() { } this.render = function(cell, data) { - cell.element.innerHTML = 'Bean(' + data.integer + ', ' + data.string + ')' + if (!cell.renderedText) { + cell.element.innerHTML = 'Bean(' + data.integer + ', ' + data.string + ')'; + } } this.getConsumedEvents = function() { return ["click"] }; this.onBrowserEvent = function(cell, event) { - cell.element.innerHTML = "Clicked " + cell.rowIndex + " with key " + this.getRowKey(cell.rowIndex) +" at " + event.clientX; + cell.renderedText ="Clicked " + cell.rowIndex + " with key " + this.getRowKey(cell.rowIndex) +" at " + event.clientX; + cell.element.innerHTML=cell.renderedText; return true; } } \ No newline at end of file diff --git a/uitest/src/main/resources/com/vaadin/v7/tests/components/grid/JavaScriptStringRenderer.js b/uitest/src/main/resources/com/vaadin/v7/tests/components/grid/JavaScriptStringRenderer.js new file mode 100644 index 0000000000..14266d3057 --- /dev/null +++ b/uitest/src/main/resources/com/vaadin/v7/tests/components/grid/JavaScriptStringRenderer.js @@ -0,0 +1,5 @@ +com_vaadin_v7_tests_components_grid_JavaScriptStringRenderer = function() { + this.render = function(cell, data) { + cell.element.textContent = data; + } +} \ No newline at end of file diff --git a/uitest/src/main/resources/com/vaadin/v7/tests/components/grid/myBeanJsRenderer.js b/uitest/src/main/resources/com/vaadin/v7/tests/components/grid/myBeanJsRenderer.js new file mode 100644 index 0000000000..45aff71a7b --- /dev/null +++ b/uitest/src/main/resources/com/vaadin/v7/tests/components/grid/myBeanJsRenderer.js @@ -0,0 +1,16 @@ +window.com_vaadin_v7_tests_components_grid_MyBeanJSRenderer = function() { + this.init = function(cell) { + cell.element.setAttribute("column", cell.columnIndex); + } + + this.render = function(cell, data) { + cell.element.innerHTML = 'Bean(' + data.integer + ', ' + data.string + ')' + } + + this.getConsumedEvents = function() { return ["click"] }; + + this.onBrowserEvent = function(cell, event) { + cell.element.innerHTML = "Clicked " + cell.rowIndex + " with key " + this.getRowKey(cell.rowIndex) +" at " + event.clientX; + return true; + } +} \ No newline at end of file -- cgit v1.2.3