How can I make the GWT list box an editable part from the selection

In accordance with my requirement, I wrote a custom panel that will display three lists, allowing the user to select a date from these custom lists. These three lists are responsible for displaying the values โ€‹โ€‹of the month, day, year. Now I would like to make my three list boxes be editable and at the same time selected. I mean, I would like to provide custom settings that can be editable and at the same time optional. How can I do this in GWT. Here I am using GWT2.0. Anyone please give an idea.

+4
source share
3 answers

The browser does not provide such control. Also there is no GWT. You will need to encode your own. EXT-GWT (not free) ComboBox has this functionality. http://www.extjs.com/examples/ Also Smart GWT (also not free) http://www.smartclient.com/smartgwt/showcase/#styled_combobox_category

If you must roll on your own, you will start with a Composite that has a TextBox and a VerticalPanel that displays when a TextBox (or part of it) is clicked. Your panel will contain items that are clickable.

+2
source

You can use this using the suggestBox clause instead of a list. But the user will have to start typing to display the list.

+1
source

You can use the absolute panel to achieve the same ... Below is a snippet of code.

Hide the selection box with a text box, adjust the width and position of the text box so that it displays a drop-down list ...

final AbsolutePanel absolute_panel_edit_list = new AbsolutePanel(); final TextBox onhold_textbox = new TextBox(); final ListBox onhold = new ListBox(); for (int onholdcount = 0; onholdcount < onHoldTypes.length; onholdcount++) { onhold.addItem(onHoldTypes[onholdcount]); } onhold.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { onhold_textbox.setStyleName("onhold_textbox"); absolute_panel_edit_list.add(onhold,0,8); absolute_panel_edit_list.add(onhold_textbox,1,10); absolute_panel_edit_list.setSize("142px", "35px"); flex_row4.removeCell(4, 9); flex_row4.setWidget(4, 9, absolute_panel_edit_list); onhold_textbox.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { String customized_time = onhold_textbox.getText(); int no_of_elements = onhold.getItemCount(); onhold.addItem(customized_time); onhold.setSelectedIndex(no_of_elements); flex_row4.removeCell(4, 9); flex_row4.setWidget(4, 9, onhold); flex_row4.setWidget(4, 11, completed_togglebutton); flex_row4.setWidget(4, 13, completed_label); } }); } }); 
0
source

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


All Articles