Total in the Grid

QuestionsTotal in the Grid
Marcos Paulo asked 9 years ago

Hi Abu and developers. I've the premium version, and this is my very first time here. I will start with a simple question. I was able to create the footer-row, with total, subtotal and grand total, and total to selected rows are working too, but I just want a total considering the filters and search options, in other words, 1000 rows, total price for these 1000, search/filter reduces to 500 registers, total price for that, not considering the pages of the grid. My idea is to change the code http://pastebin.com/JGj1Dqgq, using something like: $swhere = $_GET['sfilter']; and $rs = mysql_fetch_assoc(mysql_query("SELECT SUM(vlr_cust_total) as s FROM (SELECT vlr_cust_total FROM cdr WHERE $swhere ORDER BY $sidx $sord LIMIT $rows) AS tmp"));. Could you please help me? Thanks in advance.

2 Answers
Abu Ghufran answered 9 years ago

Hello,

Given that your grid id is list1, you can use following session variable.

$swhere = 'WHERE 1=1 ' . $_SESSION["jqgrid_list1_filter"];

This session var will contains string like 'AND invdate like %2007%' or empty string if nothing is filtered.

Marcos Paulo answered 9 years ago

Hi Abu. Thanks a lot. It's working fine. I think this is very useful for all and several other situations. I removed the LIMIT and change to $swhr = '1=1 '.$_SESSION["jqgrid_cdr1_filter"]; $rs = mysql_fetch_assoc(mysql_query("SELECT SUM(vlr_cust_total) as s FROM (SELECT vlr_cust_total FROM cdr WHERE $swhr ORDER BY $sidx $sord) AS tmp")); Thanks again.

Your Answer

12 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?