Re: WOAjaxCollapsibleComponentContent ???

2024-06-26 Thread Aaron Rosenzweig via Webobjects-dev
Hi Markus :-)

Glad that worked out for you. I think there is an AjaxExamples project in 
WOnder which is an app you can run and see a few things. 

You pick up on things after toiling with it for a while. 


> On Jun 26, 2024, at 7:34 AM, mailinglists  wrote:
> 
> Thanks Aaron, works perfectly. 
> 
> Other than looking at the code how would one discover what AjaxHyperlink and 
> friends can do? The documentation / JavaDoc is not very revealing.
> 
> ---markus---
> 
>> On 23 Jun 2024, at 17:43, Aaron Rosenzweig  wrote:
>> 
>> Hi Markus, 
>> 
>> To use  like you envision you need to add some 
>> scaffolding. 
>> 
>> Realize that the ajax link and the ajax submit button can be given a named 
>> function. When you do that, they don’t render, put provide a name you can 
>> call on the client side that will do a round trip to the server. So you need 
>> to consider if you have a form (or not) and if you want to synchronize 
>> bindings (or not) to choose between them. But let’s assume you just want a 
>> “click” without form values going across. You’ll need to place an element 
>> like this near your :
>> 
>> > ERXWOContext.safeIdentifierName(context(), true /*willCache*/);
>>   }
>>   return _toggleFunctionName;
>> }
>> 
>> public WOActionResults toggle() {
>>   setIsOpen( ! isOpen());
>>   return null;
>> }
>> 
>> 
>> Then you’ll need to build your summary tag as a container element and listen 
>> to click events like so:
>> 
>> >   return code;
>> }
>> 
>> Or if there is a lot of complex stuff going on and race conditions with JS 
>> events maybe you need a hack to invoke Ajax on a delay
>> public String onclickJavascript(){
>>   String code = "setTimeout(" + toggleFunctionName() + ", 500); return 
>> true;";
>>   return code;
>> }
>> 
>> Notice that there is no update container specified on the AjaxHyperlink. 
>> That’s because you don’t need to refresh anything, you only need to tell the 
>> server the state of open/close. 
>> 
>> 
>>> On Jun 23, 2024, at 7:28 AM, mailinglists via Webobjects-dev 
>>>  wrote:
>>> 
>>> Anyone using this component? It has bindings that seem not to be used.  
>>> Does this work at all? I cannot make sense of it.
>>> 
>>> Alternatively has anyone made proper use of the html construct 
>>> ? It works nicely but I cannot preserve “open” state when 
>>> updating an enclosing container because I have not found a way to call back 
>>> into the server when the summary is clicked to open/close. This action is 
>>> pure client side performed by the browser itself. Any way to tap into it?
>>> 
>>> Any other usable component around for such a hide/reveal functionality?
>>> 
>>> Thanks for your ideas
>>> ---markus---
>>> 
>>> 
>>> ___
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>>> 
>>> This email sent to aa...@chatnbike.com
>> 
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: WOAjaxCollapsibleComponentContent ???

2024-06-26 Thread mailinglists via Webobjects-dev
Thanks Aaron, works perfectly. 

Other than looking at the code how would one discover what AjaxHyperlink and 
friends can do? The documentation / JavaDoc is not very revealing.

---markus---

> On 23 Jun 2024, at 17:43, Aaron Rosenzweig  wrote:
> 
> Hi Markus, 
> 
> To use  like you envision you need to add some scaffolding. 
> 
> Realize that the ajax link and the ajax submit button can be given a named 
> function. When you do that, they don’t render, put provide a name you can 
> call on the client side that will do a round trip to the server. So you need 
> to consider if you have a form (or not) and if you want to synchronize 
> bindings (or not) to choose between them. But let’s assume you just want a 
> “click” without form values going across. You’ll need to place an element 
> like this near your :
> 
>  ERXWOContext.safeIdentifierName(context(), true /*willCache*/);
>}
>return _toggleFunctionName;
> }
> 
> public WOActionResults toggle() {
>setIsOpen( ! isOpen());
>return null;
> }
> 
> 
> Then you’ll need to build your summary tag as a container element and listen 
> to click events like so:
> 
> return code;
> }
> 
> Or if there is a lot of complex stuff going on and race conditions with JS 
> events maybe you need a hack to invoke Ajax on a delay
> public String onclickJavascript(){
>String code = "setTimeout(" + toggleFunctionName() + ", 500); return 
> true;";
>return code;
> }
> 
> Notice that there is no update container specified on the AjaxHyperlink. 
> That’s because you don’t need to refresh anything, you only need to tell the 
> server the state of open/close. 
> 
> 
>> On Jun 23, 2024, at 7:28 AM, mailinglists via Webobjects-dev 
>>  wrote:
>> 
>> Anyone using this component? It has bindings that seem not to be used.  Does 
>> this work at all? I cannot make sense of it.
>> 
>> Alternatively has anyone made proper use of the html construct 
>> ? It works nicely but I cannot preserve “open” state when 
>> updating an enclosing container because I have not found a way to call back 
>> into the server when the summary is clicked to open/close. This action is 
>> pure client side performed by the browser itself. Any way to tap into it?
>> 
>> Any other usable component around for such a hide/reveal functionality?
>> 
>> Thanks for your ideas
>> ---markus---
>> 
>> 
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>> 
>> This email sent to aa...@chatnbike.com
> 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com