dataScroller: concurrent clicks with stateful tables
bedag-moo Aug 31, 2010 12:26 PMI have a rich:dataTable containing input components (in our case, comboboxes) in each row, and an attached rich:dataScroller. Since we want to submit changes made to the comboboxes, the dataScroller's ajaxSingle is false.
This works fine - until the users click the the dataScroller faster than the server can answer the AJAX request. Then, the second request fails with a validation error. Here's a slightly sanitized output of a4j:log:
debug[14:40:48,272]: Have Event [object Object] with properties: target: [object HTMLTableCellElement], srcElement: undefined, type: dataavailable
debug[14:40:48,272]: Query preparation for form 'ourForm requested'
debug[14:40:48,272]: Append hidden control ...
(more controls)
debug[14:40:48,276]: Look up queue with default name
debug[14:40:48,276]: Creating new transient queue 'dataScroller' with default settings
debug[14:40:48,276]: Adding queue 'dataScroller' to queues registry
debug[14:40:48,277]: Queue is empty now
debug[14:40:48,277]: New request added to queue 'dataScroller'. Queue similarityGroupingId changed to dataScroller
debug[14:40:48,277]: Queue will wait 0ms before submit
debug[14:40:48,277]: Queue 'dataScroller' will submit request NOW
debug[14:40:48,277]: NEW AJAX REQUEST !!! with form: ourForm
debug[14:40:48,277]: Start XmlHttpRequest
debug[14:40:48,278]: Reqest state : 1
debug[14:40:48,278]: QueryString: ...
debug[14:40:48,278]: Reqest state : 1
debug[14:40:48,464]: Have Event [object Object] with properties: target: [object HTMLTableCellElement], srcElement: undefined, type: dataavailable
debug[14:40:48,464]: Query preparation for form 'ourForm requested'
debug[14:40:48,464]: Append hidden control ...
(more controls)
debug[14:40:48,467]: Look up queue with default name
debug[14:40:48,467]: Found transient queue 'dataScroller'
debug[14:40:48,468]: Similar request currently in queue 'dataScroller'
debug[14:40:48,468]: Request has already beeen sent to server
debug[14:40:48,468]: Duplicate responses ignore requested
debug[14:40:48,468]: Response for the current request will be ignored
debug[14:40:48,468]: New request added to queue 'dataScroller'. Queue similarityGroupingId changed to dataScroller
debug[14:40:48,468]: Queue will wait 0ms before submit
debug[14:40:48,525]: Reqest state : 2
debug[14:40:48,542]: After request: queue 'dataScroller'
debug[14:40:48,542]: There are 1 requests more in this queue
debug[14:40:48,542]: Queue 'dataScroller' will submit request NOW
debug[14:40:48,542]: NEW AJAX REQUEST !!! with form: ourForm
debug[14:40:48,542]: Start XmlHttpRequest
debug[14:40:48,542]: Reqest state : 1
debug[14:40:48,543]: QueryString: ...
As you can see, the requests are queued and sent sequentially. They are also identical, i.e. they both send the state for the comboboxes of the first page to the server. However, processing the first page creates the combobox-components for the second page, and when the second request is received, the server is missing values for these components, causing validation to fail.
Ideally, the dataScroller would construct the second request after the first has been processed, so it could submit the state of the newly arrived components. Is there a way I can achieve that?
Realistically, I would be happy if too rapid clicks into the datascroller would be ignored. But it appears there is no JavaScript-API to disable the dataScroller? Must I really resort to navigating the HTML elements it renders and remove the onclick-handler?
Any other ideas?
PS: I am using richfaces-3.3.1.GA