public inbox for [email protected]  
help / color / mirror / Atom feed
[RM#4508] Fix tab navigation issue with Backgrid Datetime cell
2+ messages / 2 participants
[nested] [flat]

* [RM#4508] Fix tab navigation issue with Backgrid Datetime cell
@ 2019-07-24 11:29 Murtuza Zabuawala <[email protected]>
  2019-07-25 12:26 ` Re: [RM#4508] Fix tab navigation issue with Backgrid Datetime cell Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Murtuza Zabuawala @ 2019-07-24 11:29 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

PFA minor patch to fix the tab navigation issue with Backgrid datetime cell.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Attachments:

  [application/octet-stream] fix_datetime_backgrid.diff (2.0K, 3-fix_datetime_backgrid.diff)
  download | inline diff:
diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js
index 1c4f6f1e99..f90ed380a6 100644
--- a/web/pgadmin/static/js/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid.pgadmin.js
@@ -1753,6 +1753,7 @@ define([
             },
           },
         });
+      this.tabKeyPress = false;
       this.$el.datetimepicker(options);
       this.$el.datetimepicker('show');
       this.picker = this.$el.data('DateTimePicker');
@@ -1760,27 +1761,41 @@ define([
     events: {
       'hide.datetimepicker': 'closeIt',
       'focusout':'closeIt',
+      'keydown': 'keydownHandler',
+    },
+    keydownHandler: function(event) {
+      // If Tab key pressed from Cell and not from Datetime picker element
+      // then we should trigger edited event so that we can goto next cell
+      let self = this;
+      let tabKeyPressed = true;
+      if (event.keyCode === 9 && self.el === event.target) {
+        self.closeIt(event, tabKeyPressed);
+      }
     },
-    closeIt: function(ev) {
+    closeIt: function(ev, isTabKeyPressed) {
+      if (this.is_closing || this.tabKeyPress)
+        return;
+
+      this.is_closing = true;
+      this.tabKeyPress = isTabKeyPressed;
+
       var formatter = this.formatter,
         model = this.model,
         column = this.column,
         val = this.$el.val(),
         newValue = formatter.toRaw(val, model);
 
-      if (this.is_closing)
-        return;
-      this.is_closing = true;
       this.$el.datetimepicker('destroy');
       this.is_closing = false;
 
-      var command = new Backgrid.Command(ev);
-
       if (_.isUndefined(newValue)) {
         model.trigger('backgrid:error', model, column, val);
       } else {
         model.set(column.get('name'), newValue);
-        model.trigger('backgrid:edited', model, column, command);
+        let command = new Backgrid.Command(ev);
+        setTimeout(() => {
+          model.trigger('backgrid:edited', model, column, command);
+        }, 20);
       }
     },
   });


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

* Re: [RM#4508] Fix tab navigation issue with Backgrid Datetime cell
  2019-07-24 11:29 [RM#4508] Fix tab navigation issue with Backgrid Datetime cell Murtuza Zabuawala <[email protected]>
@ 2019-07-25 12:26 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2019-07-25 12:26 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Thanks patch applied.

On Wed, Jul 24, 2019 at 4:59 PM Murtuza Zabuawala <
[email protected]> wrote:

> Hi,
>
> PFA minor patch to fix the tab navigation issue with Backgrid datetime
> cell.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


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


end of thread, other threads:[~2019-07-25 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 11:29 [RM#4508] Fix tab navigation issue with Backgrid Datetime cell Murtuza Zabuawala <[email protected]>
2019-07-25 12:26 ` Akshay Joshi <[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