Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown in client if we put the Grid into dialog and callled "setDataProvider()" "select" twice #1102

Open
6 tasks
yurili8 opened this issue Sep 16, 2020 · 0 comments

Comments

@yurili8
Copy link

yurili8 commented Sep 16, 2020

Description

Exception is thrown in client if we put the Grid into dialog and callled "setDataProvider()" "select" twice

Expected outcome

when open the dialog again, fetch the data from DB and set the DataProvider, it should work.

because we often to add some data in some page and go back to another page to open the dialog, that time we should refresh the page content, it should work

Actual outcome

It will throw exception in browser

Live Demo

Steps to reproduce

`@Route(value = "hello", layout = MainView.class)
@PageTitle("Hello World")
@CssImport("./styles/views/helloworld/hello-world-view.css")
@RouteAlias(value = "", layout = MainView.class)
public class HelloWorldView extends HorizontalLayout {

private Button sayHello;
Dialog dialog = new Dialog();

List<String> list = new ArrayList<>();

private Grid<String> grid = new Grid<String>();

public HelloWorldView() {


    list.add("aa");
    list.add("bb");
    list.add("cc");
    grid.setWidth("300px");
    grid.setHeight("300px");
    grid.addColumn(String::toString);
    dialog.add(grid);

    setId("hello-world-view");
    sayHello = new Button("Say hello");
    add(sayHello);
    sayHello.addClickListener(e -> {
        // we will fetch the data from db in my actual environment, here I just create one list.
        grid.setDataProvider(DataProvider.fromStream(list.stream()));
        Random random = new Random();
        grid.select(list.get(random.nextInt(3)));

        //first time, it will work, everything looks good. But when you call it again ,it will throw exception.
        // this is just one demo, it is different with my actual environment. this code just proves the issue.
        //and it already blocked our development process. hope it could be resolved soon. thanks.
        dialog.open();
    });
}

}`

Browsers Affected

  • [] Chrome
  • Firefox
  • Safari
  • Edge
  • IE 11
  • iOS Safari
  • Android Chrome
@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-grid May 19, 2021
@vaadin-bot vaadin-bot transferred this issue from vaadin/web-components May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants