Hi all,

Please find a patch attached that:

Ensure View Data mode fetches next rows on scrolling through results when
appropriate. Fixes #4536.

Thanks.
-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 5f7fde7c..7f1e0241 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -716,8 +716,6 @@ define('tools.querytool', [
       self.handler.rows_to_disable = new Array();
       // Temporarily hold new rows added
       self.handler.temp_new_rows = new Array();
-      self.handler.has_more_rows = false;
-      self.handler.fetching_rows = false;
 
       // To store primary keys before they gets changed
       self.handler.primary_keys_data = {};
@@ -2247,8 +2245,8 @@ define('tools.querytool', [
         self.on('pgadmin-sqleditor:unindent_selected_code', self._unindent_selected_code, self);
       },
 
-      // This function checks if there is any dirty data in the grid before
-      // it executes the sql query
+      // Checks if there is any dirty data in the grid before
+      // it executes the sql query in View Data mode
       execute_data_query: function() {
         var self = this;
 
@@ -2277,7 +2275,7 @@ define('tools.querytool', [
         }
       },
 
-      // This function makes the ajax call to execute the sql query.
+      // This function makes the ajax call to execute the sql query in View Data mode
       _run_query: function() {
         var self = this,
           url = url_for('sqleditor.view_data_start', {
@@ -2288,6 +2286,9 @@ define('tools.querytool', [
         self.rows_affected = 0;
         self._init_polling_flags();
 
+        self.has_more_rows = false;
+        self.fetching_rows = false;
+
         self.trigger(
           'pgadmin-sqleditor:loading-icon:show',
           gettext('Running query...')
@@ -3665,8 +3666,8 @@ define('tools.querytool', [
         }
       },
 
-      // This function will fetch the sql query from the text box
-      // and execute the query.
+      // Checks if there is any dirty data in the grid before
+      // it executes the sql query in Query Tool mode
       execute: function(explain_prefix, shouldReconnect=false) {
         var self = this;
 
@@ -3695,6 +3696,7 @@ define('tools.querytool', [
         }
       },
 
+      // Executes sql query in the editor in Query Tool mode
       _execute_sql_query: function(explain_prefix, shouldReconnect) {
         var self = this, sql = '';
 

Reply via email to