Skip to content

Commit 52eb2d2

Browse files
fix: ignore row details cells when applying cell update animation (#7079) (#7081)
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
1 parent 0f29182 commit 52eb2d2

3 files changed

Lines changed: 90 additions & 6 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* This program is available under Vaadin Commercial License and Service Terms.
5+
*
6+
* See {@literal <https://vaadin.com/commercial-license-and-service-terms>} for the full
7+
* license.
8+
*/
9+
package com.vaadin.flow.component.gridpro.tests;
10+
11+
import java.util.List;
12+
13+
import com.vaadin.flow.component.gridpro.GridPro;
14+
import com.vaadin.flow.component.html.Div;
15+
import com.vaadin.flow.component.textfield.TextField;
16+
import com.vaadin.flow.data.renderer.TextRenderer;
17+
import com.vaadin.flow.router.Route;
18+
19+
@Route(value = "gridpro-item-details")
20+
public class GridProItemDetailsPage extends Div {
21+
22+
public GridProItemDetailsPage() {
23+
List<SamplePerson> persons = List.of(new SamplePerson("Henry"),
24+
new SamplePerson("Indiana"), new SamplePerson("Jones"));
25+
26+
GridPro<SamplePerson> grid = new GridPro<>();
27+
grid.addColumn(SamplePerson::getName).setHeader("Readonly Name");
28+
grid.addEditColumn(SamplePerson::getName)
29+
.custom(new TextField(), SamplePerson::setName)
30+
.setHeader("Editable Name");
31+
grid.setItemDetailsRenderer(new TextRenderer<>(
32+
person -> "Details for " + person.getName()));
33+
grid.setItems(persons);
34+
35+
add(grid);
36+
}
37+
38+
public static class SamplePerson {
39+
private String name;
40+
41+
public SamplePerson(String name) {
42+
this.name = name;
43+
}
44+
45+
public String getName() {
46+
return name;
47+
}
48+
49+
public void setName(String name) {
50+
this.name = name;
51+
}
52+
}
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* This program is available under Vaadin Commercial License and Service Terms.
5+
*
6+
* See {@literal <https://vaadin.com/commercial-license-and-service-terms>} for the full
7+
* license.
8+
*/
9+
package com.vaadin.flow.component.gridpro.tests;
10+
11+
import org.junit.Before;
12+
import org.junit.Test;
13+
14+
import com.vaadin.flow.component.gridpro.testbench.GridProElement;
15+
import com.vaadin.flow.testutil.TestPath;
16+
import com.vaadin.tests.AbstractComponentIT;
17+
18+
@TestPath("gridpro-item-details")
19+
public class GridProItemDetailsIT extends AbstractComponentIT {
20+
21+
@Before
22+
public void before() {
23+
open();
24+
$(GridProElement.class).waitForFirst();
25+
}
26+
27+
@Test
28+
public void noErrorsLogged() {
29+
checkLogsForErrors();
30+
}
31+
}

vaadin-grid-pro-flow-parent/vaadin-grid-pro-flow/src/main/resources/META-INF/resources/frontend/gridProConnector.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ window.Vaadin.Flow.gridProConnector = {
5454

5555
// Not needed in case of custom editor as value is set on server-side.
5656
// Overridden in order to avoid blinking of the cell content.
57-
column._setEditorValue = function(editor, value) {
58-
};
57+
column._setEditorValue = function (editor, value) {};
5958

6059
const stopCellEdit = column._stopCellEdit;
61-
column._stopCellEdit = function() {
60+
column._stopCellEdit = function () {
6261
stopCellEdit.apply(this, arguments);
6362
this._grid.toggleAttribute(LOADING_EDITOR_CELL_ATTRIBUTE, false);
6463
};
@@ -82,7 +81,7 @@ window.Vaadin.Flow.gridProConnector = {
8281
},
8382

8483
initCellEditableProvider(column) {
85-
column.isCellEditable = function(model) {
84+
column.isCellEditable = function (model) {
8685
// If there is no cell editable data, assume the cell is editable
8786
const isEditable = model.item.cellEditable && model.item.cellEditable[column._flowId];
8887
return isEditable === undefined || isEditable;
@@ -106,11 +105,12 @@ window.Vaadin.Flow.gridProConnector = {
106105

107106
// Override the method to add the updating-cell part to the cell when it's being updated.
108107
const generateCellPartNames = grid._generateCellPartNames;
109-
grid._generateCellPartNames = function(row, model) {
108+
grid._generateCellPartNames = function (row, model) {
110109
generateCellPartNames.apply(this, arguments);
111110

112111
iterateRowCells(row, (cell) => {
113-
const isUpdating = model && grid.__pendingCellUpdate === `${model.item.key}:${cell._column.path}`;
112+
const isUpdating =
113+
model && cell._column && grid.__pendingCellUpdate === `${model.item.key}:${cell._column.path}`;
114114
const target = cell._focusButton || cell;
115115
updatePart(target, isUpdating, 'updating-cell');
116116
});

0 commit comments

Comments
 (0)