public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
4+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
@ 2016-07-06 08:16  Surinder Kumar <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Surinder Kumar @ 2016-07-06 08:16 UTC (permalink / raw)
  To: pgadmin-hackers

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

Thanks,
Surinder Kumar


-- 
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.patch (1.1K, 3-RM%231435.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..24e2697 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -1816,6 +1816,9 @@ define(
             }
             else {
               self.collection.add(empty_model);
+              // scroll to new added row
+              var dgrid = document.getElementById("datagrid");
+              dgrid.scrollTop = dgrid.scrollHeight;

               /* If no of items on the page exceeds the page size limit then
                * advanced to the next page.
@@ -2319,6 +2322,9 @@ define(
             }
             else {
               self._paste_row();
+              // scroll to new added row
+              var dgrid = document.getElementById("datagrid");
+              dgrid.scrollTop = dgrid.scrollHeight;

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


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
@ 2016-07-07 09:00  Dave Page <[email protected]>
  parent: Surinder Kumar <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Dave Page @ 2016-07-07 09:00 UTC (permalink / raw)
  To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers

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.

-- 
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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
@ 2016-07-07 10:07  Surinder Kumar <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Surinder Kumar @ 2016-07-07 10:07 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-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.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end
@ 2016-07-07 11:36  Dave Page <[email protected]>
  parent: Surinder Kumar <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Dave Page @ 2016-07-07 11:36 UTC (permalink / raw)
  To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Thu, Jul 7, 2016 at 11:07 AM, Surinder Kumar
<[email protected]> wrote:
> 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
>
>



-- 
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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2016-07-07 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 08:16 [pgAdmin4][Patch]: RM#1435 - "Move to last page" should also scroll to end Surinder Kumar <[email protected]>
2016-07-07 09:00 ` Dave Page <[email protected]>
2016-07-07 10:07   ` Surinder Kumar <[email protected]>
2016-07-07 11:36     ` Dave Page <[email protected]>

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