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 <aa...@chatnbike.com> wrote: > > Hi Markus, > > To use <details><summary> 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 <details><summary>: > > <wo:AjaxHyperlink functionName = "$toggleFunctionName" action = "$toggle” /> > > Bindings could be implemented like so: > > public String toggleFunctionName() { > if (StringUtils.isBlank(_toggleFunctionName)) { > _toggleFunctionName = "details_summary_" + > 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: > > <wo:genericContainer elementName = "summary" onclick = "$onclickJavascript”> > Summary text > </wo:genericContainer> > > The click text could be: > > public String onclickJavascript(){ > String code = toggleFunctionName() + "(); return true;"; > 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 >> <webobjects-dev@lists.apple.com> 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 >> <details><summary>? 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