From e05dd3859831fd6945bb36015ec9ae46cbe76725 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 26 Aug 2016 12:06:39 +0530 Subject: [PATCH 1/2] [fix] paging issues in listview (#2011) --- frappe/model/db_query.py | 19 +++++++++---------- frappe/public/js/frappe/ui/listing.html | 2 +- frappe/public/js/frappe/ui/listing.js | 16 ++++++++++++---- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py index 7b634e6ce7..7800b71823 100644 --- a/frappe/model/db_query.py +++ b/frappe/model/db_query.py @@ -11,7 +11,7 @@ import frappe.permissions from frappe.utils import flt, cint, getdate, get_datetime, get_time, make_filter_tuple, get_filter from frappe import _ from frappe.model import optional_fields -from frappe.model.utils.list_settings import update_list_settings +from frappe.model.utils.list_settings import get_list_settings, update_list_settings class DatabaseQuery(object): def __init__(self, doctype): @@ -492,14 +492,13 @@ class DatabaseQuery(object): def update_list_settings(self): # update list settings if new search - if not cint(self.limit_start) or cint(self.limit_page_length) != 20: - list_settings = { - 'filters': self.filters, - 'limit': self.limit_page_length, - 'order_by': self.order_by - } - if self.save_list_settings_fields: - list_settings['fields'] = self.fields + list_settings = json.loads(get_list_settings(self.doctype) or '{}') + list_settings['filters'] = self.filters + list_settings['limit'] = self.limit_page_length + list_settings['order_by'] = self.order_by - update_list_settings(self.doctype, list_settings) + if self.save_list_settings_fields: + list_settings['fields'] = self.fields + + update_list_settings(self.doctype, list_settings) diff --git a/frappe/public/js/frappe/ui/listing.html b/frappe/public/js/frappe/ui/listing.html index 28c23f737e..44d57887f0 100644 --- a/frappe/public/js/frappe/ui/listing.html +++ b/frappe/public/js/frappe/ui/listing.html @@ -24,7 +24,7 @@
-