Hi,

I want to disable all preselected enteries in 'selected' choice box(so that
user can't move those choices to available list). Please suggest some
solution.

I have tried one solution, by overriding inBeforeRender method and in that
method i've get 'selectedChoicesComponent' and disable all childs, but i am
getting null for selectedChoicesComponent.

        @Override
        protected void onBeforeRender() {
                super.onBeforeRender();
                Selection<T> selectedChoicesComponent =
(Selection<T>)getSelectionComponent();

        //Just to check, i have disabled 1st child,if it works we can easliy
disable other childs    
        selectedChoicesComponent.get(0).setEnabled(false);
  
        }
getSelectionComponent() - returns null.


Thanks,
Dhiraj

Martin Dietze wrote:
> 
> 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: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Repost%3A-Track-selected-entries-in-either-of-a-Palette%27s-Choices-components--tp26922651p27432901.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to