Hi, perhaps you can help me.
When i try to select the first line of my grid i have this error on the page in the brower
“(typeerror) $0.$connector is undefined”.
For information my grid is loaded simply with those code
List<TarifT> listT = recupTarif();
gridTarif.setItems(listT);
if (listT.size() > 0)
gridTarif.select(listT.get(0)); //it's the line that cause the bug
OK sorry, I’m going to explain my application.
I have on my home page a grid with different elements.
When i double clicked on a row I open a dialog that contains a grid
with several row. In this grid I want to select the first line when the dialog
is opened.
You can find below my code for the dialog
public class DlgTest extends Dialog
{
private static final long serialVersionUID = 1L;
private ComposantTRepository repoComp;
private TarifTRepository tarifRepo;
private ComposantT compCourant;
private Grid<TarifT> gridTarif = new Grid<>();
private ButtonSteel bt;
// ********** Constructeur **********
public DlgTest(
ComposantTRepository argRepoComp, TarifTRepository tarifRepo) {
this.repoComp = argRepoComp;
this.tarifRepo = tarifRepo;
this.setCloseOnEsc(false);
this.setCloseOnOutsideClick(false);
this.setWidth("1100px");
gridTarif.addThemeVariants(GridVariant.LUMO_COLUMN_BORDERS, GridVariant.LUMO_ROW_STRIPES, GridVariant.LUMO_COMPACT);
// gestion colonnes grilles
Column<TarifT> colCodeFour = gridTarif.addColumn(tarif -> tarif.getTaktcode()).setHeader("Code fournisseur")
.setWidth("120px");
add(gridTarif);
bt = new ButtonSteel("close");
bt.addClickListener(event -> close());
add(bt);
}
/**
*
*/
public void loadgridTarif(ComposantT comp) {
compCourant = comp;
List<TarifT> listT = recupTarif();
gridTarif.setItems(listT);
if (listT.size() > 0)
gridTarif.select(listT.get(0)); //this is the line that cause bug !!!!!
}
/**
* chargement de la grille des tarifs
*/
private List<TarifT> recupTarif() {
List<TarifT> tarifs = new ArrayList<>();
if (null != compCourant)
tarifs = tarifRepo.findByTaktsocAndTaktgenreAndTaktcodartAndTaktcomart(SteelConstant.KTSOC, "2", compCourant.getArktcodart(),
compCourant.getArktcomart());
else
tarifs = new ArrayList<TarifT>();
if (null == tarifs || null == tarifs.get(0))
{
return new ArrayList<TarifT>();
}
else
{
return tarifs;
}
}
and this is the code implement used when I double clicked on a grid row of my home page
I tried reproducing the problem with that code sample; I replaced the missing classes with dummy implementations the best I could, but I still didn’t manage to get that exception, sorry. I would suggest that you try to create a minimal sample that reproduces the issue without any non-Vaadin classes like ComposantTRepository, TarifTRepository, ComposantT, ButtonSteel etc. - these should not be related to the issue.