I have a lot of DropDownChoice components with many items in a form, and on loading the form, I'd like to display only the saved selected options. When the user clicks on a DropDownChoice, I'd like to ajax-load the full item list on the fly.
Can this be done?
Add a OnChangeAjaxBehavior to your dropdown-component. Override the onUpdate-method and add another component to the target. The chosen value of the dropdown-component is inside its model.
Update: Okey, I think I know what you're trying to achieve. Add an AjaxFormComponentUpdatingBehavior to your dropdown component with "onclick" as constructor parameter.
Override the onUpdate-method and add your dropdown component to the target. Before you do that, update the dropdown model, so that it now contains all values.
If you have a lot of options to show then using <select> is not the best option.
Better check http://ivaynberg.github.com/select2/ or http://livedocs.dojotoolkit.org/dijit/form/FilteringSelect or any other JS based component which can load options on demand via Ajax.
Maybe you could go with the AjaxEditableLabels... Using the AjaxEditableChoiceLabel from Wicket Extensions, you'll get a compponent that displays the current value as a Label until clicked and the changes to a DropDownChoice via Ajax. That should be pretty much like the solution you're looking for.
Related
I have a Text field that when you write, autocompletes with the possible choices you have based on what you are writing.
There's a fixed list of favorite choices, and I have to add a checkbox to the component so the user can choose whether to see only the favourite choices or all the possible choices.
I asked google, but I can't find how to modify a component at that level.
Does anybody have hints or somewhere I can take a look at a good example?
Add an AjaxCheckBox next to the text field. When the autocompleter asks the server for values use the AjaxCheckBox's model object to decide what to return.
I am looking for a way to create a popup dialog box when a user double clicks a textinput field that will contain a scroll-able list (from database table) where the user can select a field, hit ok, and have it placed into the textbox when popup closes.
The other major requirement is to have a filter/ or search field in the popup to aid the user in finding the correct option to select from quicker.
What is the best way to implement this?
Modification to gwt's popup panel? maybe a JOptionPane? are there any simple solutions already designed for free commercial use?
You could implement this with a com.google.gwt.user.client.ui.PopupPanel. You can make a PopupPanel that contains a ListBox with your data from the database, along with a OK button. When a user selects a value and hits OK, you should utilize an EventBus along with a custom Event that will pass the value to the field on the page. The page will have an event handler that will catch the event and put it into the field.
Another option is to use a com.google.gwt.user.client.ui.SuggestBox. It is a box that autocompletes / suggests values as you type, kind of like the Youtube search bar.
I can offer more resources to help you accomplish this, if you'd like.
As per my requirements, I need to make a widget textbox prepopulate based on a selection, then under specific scenerios make the prepopulated field non-editable (from editable) without the page reloading.
The prepopulation works fine, but when I try to change my widget textbox to non-editable from the code (a validator), nothing changes. Of course I can easily make a field editable or noneditable easily on page load by setting my widget attribute directly in sql developer. But I need this to happen on the 'fly'.
So what is the proper strategy?
My thought is the widget is activated on load, and if I change the widget property I need a way to tell it to look there again w/o reloading the entire page?
Any thoughts would be greatly appreciated :)
I think TextBox#setReadOnly should work.
I've got a Textfield with autocomplete and zoneUpdater mixins. Based on the typed value, I call service which returns new values for the autocomplete select. So far, so good. Big problem for me is that autocomplete select doesn't submit chosen value. I want to update different zone, based on this value. The way it works now is that I have to submit the whole form and reopen again. But that's not what customer wants, it should do it on fly without submitting the form. Is there any solution for this? Thank you.
I want to update different zone, based on this value.
I 've tried to do this with your setup and actually worked but the drawback is that the value I get as the CHANGE event of the input is what the user typed (not what the user selected from the autocomplete list).
To get the value from selected from the autocomplete list (although I 've not tried it) you should use the callback parameter of prototype's Autocompleter. Take into account that in order to do this you should rewrite a new Autocompleter mixin of your own as the Tapestry's built-in autocomplete mixin is not honoring that callback parameter.
I 've also checked out the tapestry-jquery's Autocomplete mixin and although jquery's autocomplete supports a autocompleteselect event tapestry-jquery is not handling it in it's instantiation.
I 've not checked the chenille kit autocomplete mixin which maybe can help you, I really don't know.
As far as I know you should develop your own Autocomplete mixin based on any of these and add to it the selected item event functionality.
I've got a CellTable wich work with SingleSelectionModel to make single selection and show some information into details panel. Also I've got CheckBoxCell column into this CellTable which work with another MultipleSelectionModel to make mass delete operation.
When I try to click on check box in CheckBoxCell column GWT selects row and after second click on checkbox it change checkbox state. So we should make two clicks, but I need to do it (change checkbox state) by one click.
I tried different ways to fix it:
Change dependsOnSelection and handlesSelection parameters into CheckboxCell
Change SelectionEventManager in CellTable (DefaultSelectionEventManager.createCheckboxManager(), DefaultSelectionEventManager.createCustomManager)
But it doesn't work.
I found similar problems into Internet but all of them work with one MultipleSelectionModel. It's not the same what I want, because there's details panel (So I could make only single selection).
Can anyone help me to figure out how to resolve it?
UPD:
I've just removed SingleSelectionModel and redesigned UI to working with MultipleSelectionModel. It's GWT-hell..
Try to switch your selection models: use the MultiSelectionModel as the CellTable's selection model, so that the checkboxes work as expected (with both dependsOnSelection and handlesSelection set to true), and for the master-detail feature, use a CellPreviewEvent.Handler (or DefaultSelectionEventManager#createCustomManager), and RowStyles and getRowElement+addStyleName/removeStyleName for rendering (RowStyles when the CellTable renders the rows, then getRowElement to dynamically update styling).