Re: Can WOPopupButton's selectedValue binding set a value in a component?
Re: Can WOPopupButton's selectedValue binding set a value in a component?
- Subject: Re: Can WOPopupButton's selectedValue binding set a value in a component?
- From: Hugi Thordarson <email@hidden>
- Date: Fri, 29 Mar 2019 20:20:41 +0000
Thanks for the suggestions Samuel. I've managed to get this to work _somewhat_
efficiently by catching the popup's submitted value from the request
(AjaxObserveField invokes an action that catches the formValue and fetches and
sets the appropriate object), but otherwise doing things "the WO way".
I'm showing the UI in case anyone here has done anything similar and would like
to suggest an approach:
https://www.youtube.com/watch?v=Uu1aVnPPciE
<https://www.youtube.com/watch?v=Uu1aVnPPciE>
This is with ~50 records and I'm kind of amazed at how well it works,
considering all the work that's done on each request. But I have to assume the
records can go into ~1.000 and at that point this gets dog slow (since WO of
course has to re-render the whole thing for every user interaction).
I'm not familiar with AjaxProxy and I'm not sure how deep I should go into it
if there's little knowledge or experience with it. The point with doing this
the WO way was that it served me well to save work, but I fear that the
workarounds to go the WO way might in this case actually exceed the pain level
required to just suck it up and go totally client side for this particular
function. Maybe this is the time I've been waiting for to delve a bit deeper
into vue.js/wo integration :).
Or… I might just have to rethink the UI so it fits my technology better.
Wouldn't be the first time.
- hugi
> On 29 Mar 2019, at 18:42, Samuel Pelletier <email@hidden> wrote:
>
> Hi Hugi,
>
> I think most WOComponents (and elements) only push selectedValue or selection
> if the value change.
>
> For your case, I think you should use javascript code with a AjaxProxy to
> communicate with your component controller or use some form of serialization
> using a hidden field.
>
> I never used AjaxProxy but my understanding is this create a javascript proxy
> object in the page that implements RPC to java object created by the
> component.
>
> The JS code would read the actuel values from the proxy object or by
> deserializing them from the field, render the checkbox, handle the changes in
> the ui and send back the result.
>
> Regards,
>
> Samuel
>
>> Le 29 mars 2019 à 11:58, Hugi Thordarson <email@hidden> a écrit :
>>
>> Hi all.
>> For … reasons* … I need to use the "selectedValue"-binding of a
>> WOPopupButton, rather than the "selection"-binding. However, it seems
>> "selectedValue" is unidirectional, i.e. if I bind it to a variable in a
>> component, the variable is read (to set the initially selected value when
>> the pop-up renders) but it's not set in the component when the form is
>> submitted.
>>
>> So… I guess the question is; shouldn't that binding be bidirectional, so I
>> can intercept the new [selectedValue] on form submission? It seems
>> surprising it doesn't just work, and it's tempting to think I'm simply just
>> doing something wrong.
>>
>> If anyone can shed some light on this (or suggest a workaround) I'd be most
>> grateful. It would be lovely to able to avoid stuff like updating a hidden
>> field on the client when the pop-up changes (blech) or manually getting the
>> formValue from the request (pfft).
>>
>> * For those interested in "reasons", it's that I have a few hundred select
>> boxes on a single page, each one containing the same identical list of few
>> hundred items. I'm populating these popups manually on the client using
>> JavaScript so I don't have to download a few megabytes of HTML on each
>> request. If anyone can suggest a different solution to *that* problem, then
>> that makes this question obsolete :).
>>
>> Cheers,
>> - hugi
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden