diff --git a/docs/en_US/editgrid.rst b/docs/en_US/editgrid.rst index c9f6d4723..37c462e1b 100644 --- a/docs/en_US/editgrid.rst +++ b/docs/en_US/editgrid.rst @@ -138,3 +138,8 @@ To delete a row from the grid, click the trash icon. * Click the *Help* button (?) to access online help. * Click the *Ok* button to save work. * Click the *Close* button to discard current changes and close the dialog. + +.. toctree:: + :maxdepth: 2 + + viewdata_filter \ No newline at end of file diff --git a/docs/en_US/images/viewdata_filter_dialog.png b/docs/en_US/images/viewdata_filter_dialog.png new file mode 100644 index 000000000..b451b28ec Binary files /dev/null and b/docs/en_US/images/viewdata_filter_dialog.png differ diff --git a/docs/en_US/release_notes_4_14.rst b/docs/en_US/release_notes_4_14.rst index 66f78fb1d..2022152de 100644 --- a/docs/en_US/release_notes_4_14.rst +++ b/docs/en_US/release_notes_4_14.rst @@ -16,3 +16,5 @@ Housekeeping Bug fixes ********* + +| `Issue #4199 `_ - Ensure that 'ENTER' key in the data filter should not run the query. \ No newline at end of file diff --git a/docs/en_US/toolbar.rst b/docs/en_US/toolbar.rst index fb6e37b04..12dc8621a 100644 --- a/docs/en_US/toolbar.rst +++ b/docs/en_US/toolbar.rst @@ -17,5 +17,5 @@ the selected browser node. current database context. * Use the :ref:`View Data ` button to view/edit the data stored in a selected table. -* Use the :ref:`Filtered Rows ` button to access the Data Filter popup +* Use the :ref:`Filtered Rows ` button to access the Data Filter popup to apply a filter to a set of data for viewing/editing. \ No newline at end of file diff --git a/docs/en_US/viewdata_filter.rst b/docs/en_US/viewdata_filter.rst new file mode 100644 index 000000000..7655120d7 --- /dev/null +++ b/docs/en_US/viewdata_filter.rst @@ -0,0 +1,19 @@ +.. _viewdata_filter: + + +****************************** +`View/Edit Data Filter`:index: +****************************** + +You can access *Data Filter dialog* by clicking on *Filtered Rows* toolbar button +visible on the Browser panel or by selecting *View/Edit Data -> Filtered Rows* +context menu option. + +This allows you to specify an SQL Filter to limit the data displayed +in the edit grid window: + +.. image:: images/viewdata_filter_dialog.png + :alt: View Data filter dialog window + :align: center + +.. note:: Use SHIFT + ENTER keys to apply filter. \ No newline at end of file diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js index c2fbc7bee..504971050 100644 --- a/web/pgadmin/tools/datagrid/static/js/show_data.js +++ b/web/pgadmin/tools/datagrid/static/js/show_data.js @@ -123,12 +123,24 @@ function initFilterDialog(alertify, pgBrowser) { setup:function() { return { buttons:[{ + text: '', + key: 112, + className: 'btn btn-secondary pull-left fa fa-question pg-alertify-icon-button', + attrs: { + name: 'dialog_help', + type: 'button', + label: gettext('Data Filter'), + url: url_for('help.static', { + 'filename': 'viewdata_filter.html', + }), + }, + },{ text: gettext('Cancel'), key: 27, className: 'btn btn-secondary fa fa-times pg-alertify-button', },{ text: gettext('OK'), - key: 13, + key: null, className: 'btn btn-primary fa fa-check pg-alertify-button', }], options: { @@ -141,7 +153,19 @@ function initFilterDialog(alertify, pgBrowser) { }; }, build: function() { - alertify.pgDialogBuild.apply(this); + var that = this; + alertify.pgDialogBuild.apply(that); + + // Set the tooltip of OK + $(that.__internal.buttons[2].element).attr('title', gettext('Use SHIFT + ENTER to apply filter...')); + + // For sort/filter dialog we capture the keypress event + // and on "shift + enter" we clicked on "OK" button. + $(that.elements.body).on('keypress', function(evt) { + if (evt.shiftKey && evt.keyCode == 13) { + that.__internal.buttons[2].element.click(); + } + }); }, prepare:function() { var that = this, @@ -155,7 +179,7 @@ function initFilterDialog(alertify, pgBrowser) { this.setContent($content.get(0)); // Disable OK button - that.__internal.buttons[1].element.disabled = true; + that.__internal.buttons[2].element.disabled = true; // Apply CodeMirror to filter text area. this.filter_obj = CodeMirror.fromTextArea($sql_filter.get(0), { @@ -181,9 +205,9 @@ function initFilterDialog(alertify, pgBrowser) { that.filter_obj.on('change', function() { if (that.filter_obj.getValue() !== '') { - that.__internal.buttons[1].element.disabled = false; + that.__internal.buttons[2].element.disabled = false; } else { - that.__internal.buttons[1].element.disabled = true; + that.__internal.buttons[2].element.disabled = true; } }); }, @@ -221,6 +245,15 @@ function initFilterDialog(alertify, pgBrowser) { e ); }); + } else if(closeEvent.index == 0) { + /* help Button */ + closeEvent.cancel = true; + pgBrowser.showHelp( + closeEvent.button.element.name, + closeEvent.button.element.getAttribute('url'), + null, null + ); + return; } }, };