Re: Datatable/Dataview filtering problem

2010-12-16 Thread Benedikt Schlegel
Try to implement the delay on client side. Instead of submitting the
form directly, call a function with an internal timer.
Something like:

function delayedSubmit(form) {
if (form._delayedSubmit != null)
clearTimeout(form._delayedSubmit);

form._delayedSubmit = setTimeout(function() {
form.submit();
}, 500);
}

Didnt run this code but i think it should work. At least the concept
should be clear :>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Datatable/Dataview filtering problem

2010-12-16 Thread saschaleier

Hi all,

i have a problem implementing filters to my datatable.
What i want is a filter reacting on changes in the filter textfields.  
Let me call it 'live-filter'. So when you type, the table is filtered  
via dataprovider.


I implemented the filter from the phonebook example, but this method  
just reacts on form submit.


The next thing i tried is using a dataview instead of a datatable so i  
can reach directly the filter textfields. Then i added a  
AjaxOnUpdateBehavior to them, which submits the filterform via  
'AjaxRequestTarget'.appendJavascript(document.formxy.submit();).


The problem resulting: too many database queries in too short  
intervals. Sometimes he ignored letters from the textfield when you  
type a little bit faster.


so i tried implementing java.util.Timer with a little delay. So my  
thought was that you type sth and after the delay it begins to call  
the database filtering with everything you typed so far.


But when i schedule a timertask, nothing ever happens. The interesting  
thing is that logs from within the timertask's run() method are  
displayed to the console.


It seems that only the formsubmit(appendjavascript) is ignored.

Could it be that it does nothing because of the extra thread started  
for the Timer?


Do you know any solutions?

Or do you know any 'normal' and better ways to implement such a 'live'filter?


Thanks

Sascha


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org