On Fri, December 25, 2009, Martin Dietze wrote: > I desperately need to find out which entries in a Palette's two > Choices components are selected, e.g. to allow additional > operations on them using Ajax.
I solved this issue. First of all: currently the AbstractOptions class used by Palette does not support accessing this information via Ajax because of these lines: | // A piece of javascript to avoid serializing the options during AJAX | // serialization. | getResponse().write( | JavascriptUtils.SCRIPT_OPEN_TAG + | "if (typeof(Wicket) != \"undefined\" && typeof(Wicket.Form) != \"undefined\")" + | " Wicket.Form.excludeFromAjaxSerialization." + getMarkupId() + "='true';" + | JavascriptUtils.SCRIPT_CLOSE_TAG); Thus, in order to get this working at all, we'll have to patch Wicket. The patch is very simple, we move this code into a separate method which can be overridden by derived classes. I created an issue for this and attached the patch [1]. Now having applied the patch we proceed as follows. First, we need to derive our own Choices and Selection components in which we override the above code by an empty method, so that we get the selection POSTed at all. Now we can override various methods as needed; in my case implementing a custom convertInput() method was sufficient, so that I could access the currently selected entries in the two SELECTs by calling their getConvertedInput() methods which seemed the least invasive change and least likely to cause any trouble with the Palette's core functionality. Next, I derived my own custom class from Palette in which I needed to override the factory methods for creating the Choices and Selection components. Pretty easy in the end. Cheers, M'bert [1] https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12444712 -- ----------- / http://herbert.the-little-red-haired-girl.org / ------------- =+= Perl ist der gegl�ckte Versuch, einen braindump direkt ausf�hrbar zu machen. -- Lutz Donnerhacke in dasr --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
