PDA

View Full Version : totalproterty on server filtered store



pixman
6 Feb 2013, 7:45 AM
Hello,

I need a clarification for the store "totalProperty"

If the store make a request on the server , and apply a filter and a pagination ( "start", "limit" )

the totalProperty must send the total row for the filtered request ?

if yes,

I think my server must generate two mysql request
the first with the filter and le LIMIT clause -> for datas result
the second count with same sql request but without LIMIT clause. -> for totalProperty

thanks for clarification.

winkelmann
6 Feb 2013, 7:50 AM
Yes, the totalPropery must contain the total number of unpaged datasets. Otherwise, how would your paging know the total number of pages available?

If you're using MySQL you don't need to do two full queries. Simply Add SQL_CALC_FOUND_ROWS to your limited query and execute "SELECT FOUND_ROWS()" as a second query.
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows

Hope this helps!