public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
Date: Thu, 7 Jul 2016 15:37:37 +0530
Message-ID: <CAM5-9D-DGj9Fi2zE-t7mV_6+jz1U3t-wnj4iR=JnsCjs_oByuw@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoywmzmAomjkw=MX=tSoFtepyRZVeK-CgQG5yOc8L=A2UA@mail.gmail.com>
References: <CAM5-9D-RArPijootjCj4881voRzkZa6j8rDks_U4bOsNnpYrJw@mail.gmail.com>
	<CA+OCxoywmzmAomjkw=MX=tSoFtepyRZVeK-CgQG5yOc8L=A2UA@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

On Thu, Jul 7, 2016 at 2:30 PM, Dave Page <[email protected]> wrote:

> Hi
>
> On Wed, Jul 6, 2016 at 9:16 AM, Surinder Kumar
> <[email protected]> wrote:
> > Hi
> >
> > Please find attached patch with fix.
> > Every time either a new row is added or pasted. Scroll to the bottom of
> the
> > table div.
> >
> > Please review
>
> It doesn't seem to work for me in either Safari or Chrome.
>
Sorry, I missed this case, Now I have fixed it and it should work.
Please find the updated patch and review.

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM#1435_v2.patch (2.9K, 3-RM%231435_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index 295caf4..965d56e 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -1792,11 +1792,14 @@ define(
         // This function will add a new row to the backgrid.
         _add: function() {
           var self = this,
-              empty_model = new (self.collection.model);
+              empty_model = new (self.collection.model),
+              dgrid = document.getElementById("datagrid");

           // If items_per_page is zero then no pagination.
           if (self.items_per_page === 0) {
             self.collection.add(empty_model);
+            // scroll to the newly added row
+            dgrid.scrollTop = dgrid.scrollHeight;
           }
           else {
             // If current page is not the last page then confirm from the user
@@ -1808,6 +1811,8 @@ define(
                 function() {
                   self.collection.getLastPage();
                   self.collection.add(empty_model);
+                  // scroll to the newly added row
+                  dgrid.scrollTop = dgrid.scrollHeight;
                 },
                 function() {
                   // Do nothing as user canceled the operation.
@@ -1816,6 +1821,8 @@ define(
             }
             else {
               self.collection.add(empty_model);
+              // scroll to the newly added row
+              dgrid.scrollTop = dgrid.scrollHeight;

               /* If no of items on the page exceeds the page size limit then
                * advanced to the next page.
@@ -2295,11 +2302,14 @@ define(

         // This function is callback function for paste row.
         _paste_row_callback: function() {
-          var self = this;
+          var self = this,
+              dgrid = document.getElementById("datagrid");

           // If items_per_page is zero then no pagination.
           if (self.items_per_page == 0) {
             self._paste_row();
+            // scroll to the newly added row
+            dgrid.scrollTop = dgrid.scrollHeight;
           }
           else {
             // If current page is not the last page then confirm from the user
@@ -2311,6 +2321,8 @@ define(
                 function() {
                   self.collection.getLastPage();
                   self._paste_row();
+                  // scroll to the newly added row
+                  dgrid.scrollTop = dgrid.scrollHeight;
                 },
                 function() {
                   // Do nothing as user canceled the operation.
@@ -2319,6 +2331,8 @@ define(
             }
             else {
               self._paste_row();
+              // scroll to the newly added row
+              dgrid.scrollTop = dgrid.scrollHeight;

               /* If no of items on the page exceeds the page size limit then
                * advanced to the next page.


view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
  In-Reply-To: <CAM5-9D-DGj9Fi2zE-t7mV_6+jz1U3t-wnj4iR=JnsCjs_oByuw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox