简体   繁体   中英

Auto edit cell in nebula nattable

My nattable is a tree table that has custom root objects. I want to edit a cell in the table. The second column is static. But row index is dynamic. Im not able to get the correct row index for nattable edit after I add an entry into the table. The new row is added based on dialog selection.

Code:

nattableprovider.getSelectionProvider().setSelection(new StructuredSelection(obj));
SelectionLayer selLayer = nattableprovider.getBodyLayer().getSelectionLayer();
PositionCoordinate pos = selLayer.getSelectionAnchor();

nattable.doCommand(newEditCellCommand(nattable, nattable.getConfugRegistry(),nattable.getCellByPosition(2,pos.rowPositon)

First, I don't see a question. You should phrase a question if you expect an answer.

Second, you show some code that probably should trigger a selection and then activate the edit mode, but you do not show the NatTable composition. There is typically a correlation.

Third, not sure if you understand the difference of row index vs. row position. Especially because you retrieve the row position from the SelectionLayer and then want to use it on the NatTable layer. Typically there is a transformation in between, at least if you have a column header. But as you don't give an information on your NatTable composition, hard to tell. Also if you want to edit something that is not visible, the activation of the edit mode is not possible. But again, hard to say without more details. There could be multiple issues. But I suppose each is somehow related to incorrect position handling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM