简体   繁体   中英

GWT celltable How to create selectioncell in edittextcell?

I want to create editable cell with datatype boolean.

I don't want to use selectioncell for boolean data type

My testBooleanColumn column's cell contains string with value true,false..........

when I will click on cell present in testBooleanColumn then that cell should be editable and In that editable cell I want to show selection cell with value(true,false). when user changes value from selectioncell either true or false that value set to editable cell in testBooleanColumn

How to do this? any hint ? or sample code for this use case ?

There are three ways to do that:

  1. Use a CompositeCell with an ClickTextCell and a SelectionCell and override the render method of the CompositeCell to render only the ClickTextCell.
    When the ClickTextCell is clicked it will automatically call the ValueUpdater .
    In the update function of the ValueUpdater you have to set some boolean value in your ClickTextCell. Then you have to check in the render method of your CompositeCell this boolean value and if it is set, then render the SelectionCell instead of the ClickTextCell.

  2. Create a custom cell extending AbstractEditableCell for example (see this tutorial ) and implement the functionality yourself. You can check out the code for SelectionCell and EditTextCell and copy most of it. Basically you have to have some kind of a flag which is set when the cell gets focus. In the render method you have to either display a dropdownlist or just a text.

  3. Extend either EditTextCell or SelectionCell and implement the missing functionality. The advantage is that you can probably re-use some of the render methods and you don't have to write the complete render code yourself.

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