Make highlighted line gwt celltable

I have a table of cells in GWT with columns, there are three rows in each column, I want the first row to be selected by default when the application starts

something like that

mycelltable.setselectedrow(index); 

Is it possible?

thanks

her code

  display.getShortListedCVsBasedOnJob().getResumeDescriptionColumn().setFieldUpdater( new FieldUpdater<CandidateSummary, String>() { public void update(int index, CandidateSummary object, String value) { fetchResume(cvSelected, shortListedFlag); } }); 

This fetchResume () method calls, but only when I select the cell of this column, I want to call this fetchResume () method as my application launches, i.e. I want the 1st cell of the column to be selected by the Default method.

+4
source share
3 answers

Can this work?

 setSelected(Element elem, boolean selected) 

see GWT documentation

CellTable Google Web Toolkit

Hmm, I don’t see what Celltable is. I would set the initial value as follows:

 int INITAL_SET_ROW = 0; TableRowElement initalSetElement = yourCellTable.getRowElement(INITAL_SET_ROW); yourCellTable.setSelected(initialSetElement, true); 

You can try to implement it in your main method. Not tested this, hope this helps.

+1
source

The selection is handled by SelectionModel based on objects (not indexes); so you need to select the first object from your data in the SelectionModel used by CellTable (see how to use the key provider to track objects as they change the sample code in the CellTable javadoc for an example (the last example before nested class summaries).

+6
source

Just

 List<RowType> source = new LinkedList<RowType>(); //put some data to this list //populate the table table.setRowCount(source.size(), true); table.setRowData(0, source); //for example, you can select the first row RowType firstRow = source.get(0); selectionModel.setSelected(firstRow, true); 
0
source

Source: https://habr.com/ru/post/1389673/


All Articles