diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 354: fix incorrect handling of iTotalDisplayRecords and iTotalRecords in handling of ajaxtable methods

Message ID 20120312035710.10805.56146.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson March 12, 2012, 3:57 a.m. UTC
------------------------------------------------------------
revno: 354
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2012-03-12 16:55:07 +1300
message:
  fix incorrect handling of iTotalDisplayRecords and iTotalRecords in handling of ajaxtable methods
modified:
  lava/utils/data_tables/backends.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava/utils/data_tables/backends.py'
--- lava/utils/data_tables/backends.py	2012-03-07 23:39:48 +0000
+++ lava/utils/data_tables/backends.py	2012-03-12 03:55:07 +0000
@@ -246,7 +246,7 @@ 
         # Get the basic response structure
         response = super(TableBackend, self).process(query)
         queryset = self.table.full_queryset
-        response['iTotalDisplayRecords'] = self.table.full_length
+        response['iTotalRecords'] = self.table.full_length
         # 1) Apply search/filtering
         if query.sSearch:
             if query.bRegex:
@@ -255,11 +255,11 @@ 
             else:
                 if self.table.searchable_columns is None:
                     raise NotImplementedError("Searching is not implemented")
-                response['iTotalRecords'] = queryset.count()
                 queryset = queryset.filter(
                     self._build_q_for_search(query.sSearch))
+                response['iTotalDisplayRecords'] = queryset.count()
         else:
-            response['iTotalRecords'] = response['iTotalDisplayRecords']
+            response['iTotalDisplayRecords'] = response['iTotalRecords']
         # TODO: Support per-column search
         # 2) Apply sorting
         queryset = self.apply_sorting_columns(queryset, query.sorting_columns)