View Full Version : Grid + Search Plugin + Pagination + Servlet

27 Jun 2010, 5:31 PM

I am a bit of a newbie with this ExtJS thing. I have been developing in Java for a couple of months and after trying several frameworks I ended up choosing ExtJS because it had everything I wanted without the dependence of many plugins.

I am currently using a grid with remote pagination and everything works fine. I created a servlet that creates the sql dinamically based on the paremeters sent by the grid.

The problem comes when I try to implement the Search Plugin. I made it work in remote mode, but I get the count for the pagination with a simple "select count(*) from account" to make the query fast.

However, when I search for something, no matter the results it brings me several pages (The toolbar says for example page 1 of 3 even there is only one record return by the search) since its reading the count from the complete table and not the results from the search query.

I know I can basically solve this by running another query but without the "limit 0,20" parameters but it seems that I will be killing performance making two requests.

What should be the proper way of solving this?

On another note, I see that it search as long as I type something. I would like to make it search when I press enter but if you need to modify a lot of things, I leave it as it is.

Thank you all!!