Re: Re: Incremental request delay

Posted by Ralf Jung on
URL: https://discuss.orbeon.com/Incremental-request-delay-tp3009080p3017729.html

Hi,

> Have you regenerated the xforms-min.js?
Yes, I re-generated and re-packed both of the js files.

> Also, instead of repackaging the xforms.js into the jar, you can put
> it in your WEB-INF/resources/ops/javascript. Any file you put in
> WEB-INF/resources by default overrides files in the jars/classpath.
> And if you are curious why, you'll find the configuration for this in
> your web.xml. Also, you might find some information about editing the
> Orbeon Forms JavaScript code at the page below:
>
> http://wiki.orbeon.com/forms/doc/contributor-guide/development-environment/
> javascript-development
Thanks for this, good to know the "overloading" of Orbeon's virtual file system
(as I call it for myself) works even for the shipped core resources.

> The reason we implemented it this way is that if users type
> continually, if we wait for x ms after the last keystroke, we might
> not sent a request for a long time, which might not give the
> impression that the field is "incremental enough". I.e. imagine those
> two use cases:
>
> 1. Auto-translate content of a text area, or auto-rendering of
> Markdown: users will have to stop typing to see the result.
> 2. Auto-save: here again, data won't be saved until after users stop
> typing.
I agree that there are usecases for both types of behaviour. In this case, it
is about a filter, and filtering for short strings is relatively costy. Usually,
the user has some name in his mind and will enter at least 4 or 5 characters,
in which case I do not want the shorter queries to be executed.

Also, with these additional options, it seems to work now, thanks a lot! This
is much cleaner than my Javascript solution. It was not *that* hacky though:
<xxforms:script ev:event="DOMActivate">
if (filterTimer != undefined) window.clearTimeout(filterTimer);
var time = ORBEON.xforms.Document.getValue("filter").length == 1 ? 500 : 200;
// single-character queries are quite costy, so let's see if we can avoid them
filterTimer = window.setTimeout("filterTimer = undefined;
ORBEON.xforms.Document.dispatchEvent('summary-model', 'filter-update');",
time);
</xxforms:script>
But it went through the server, so if the fixed incremental update does not
suffice, I will try to add some local event listener and disable incremental and
trigger the update myself. Somehow...

Btw, a timeout of 5000ms is still not honoured, it gets update after a second
or two - but I guess that is caused by some of the other limits like delay-
before-force-incremental-request.

Kind regards,
Ralf Jung


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws