mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that 'ENTER' key in the data filter should not run the query. Fixes #4199
This commit is contained in:
parent
faa6236580
commit
1bef98fdfa
@ -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 *Help* button (?) to access online help.
|
||||||
* Click the *Ok* button to save work.
|
* Click the *Ok* button to save work.
|
||||||
* Click the *Close* button to discard current changes and close the dialog.
|
* Click the *Close* button to discard current changes and close the dialog.
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
viewdata_filter
|
BIN
docs/en_US/images/viewdata_filter_dialog.png
Normal file
BIN
docs/en_US/images/viewdata_filter_dialog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
@ -16,3 +16,5 @@ Housekeeping
|
|||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #4199 <https://redmine.postgresql.org/issues/4199>`_ - Ensure that 'ENTER' key in the data filter should not run the query.
|
@ -17,5 +17,5 @@ the selected browser node.
|
|||||||
current database context.
|
current database context.
|
||||||
* Use the :ref:`View Data <editgrid>` button to view/edit the data stored in a
|
* Use the :ref:`View Data <editgrid>` button to view/edit the data stored in a
|
||||||
selected table.
|
selected table.
|
||||||
* Use the :ref:`Filtered Rows <editgrid>` button to access the Data Filter popup
|
* Use the :ref:`Filtered Rows <viewdata_filter>` button to access the Data Filter popup
|
||||||
to apply a filter to a set of data for viewing/editing.
|
to apply a filter to a set of data for viewing/editing.
|
19
docs/en_US/viewdata_filter.rst
Normal file
19
docs/en_US/viewdata_filter.rst
Normal file
@ -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.
|
@ -123,12 +123,24 @@ function initFilterDialog(alertify, pgBrowser) {
|
|||||||
setup:function() {
|
setup:function() {
|
||||||
return {
|
return {
|
||||||
buttons:[{
|
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'),
|
text: gettext('Cancel'),
|
||||||
key: 27,
|
key: 27,
|
||||||
className: 'btn btn-secondary fa fa-times pg-alertify-button',
|
className: 'btn btn-secondary fa fa-times pg-alertify-button',
|
||||||
},{
|
},{
|
||||||
text: gettext('OK'),
|
text: gettext('OK'),
|
||||||
key: 13,
|
key: null,
|
||||||
className: 'btn btn-primary fa fa-check pg-alertify-button',
|
className: 'btn btn-primary fa fa-check pg-alertify-button',
|
||||||
}],
|
}],
|
||||||
options: {
|
options: {
|
||||||
@ -141,7 +153,19 @@ function initFilterDialog(alertify, pgBrowser) {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
build: function() {
|
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() {
|
prepare:function() {
|
||||||
var that = this,
|
var that = this,
|
||||||
@ -155,7 +179,7 @@ function initFilterDialog(alertify, pgBrowser) {
|
|||||||
|
|
||||||
this.setContent($content.get(0));
|
this.setContent($content.get(0));
|
||||||
// Disable OK button
|
// Disable OK button
|
||||||
that.__internal.buttons[1].element.disabled = true;
|
that.__internal.buttons[2].element.disabled = true;
|
||||||
|
|
||||||
// Apply CodeMirror to filter text area.
|
// Apply CodeMirror to filter text area.
|
||||||
this.filter_obj = CodeMirror.fromTextArea($sql_filter.get(0), {
|
this.filter_obj = CodeMirror.fromTextArea($sql_filter.get(0), {
|
||||||
@ -181,9 +205,9 @@ function initFilterDialog(alertify, pgBrowser) {
|
|||||||
|
|
||||||
that.filter_obj.on('change', function() {
|
that.filter_obj.on('change', function() {
|
||||||
if (that.filter_obj.getValue() !== '') {
|
if (that.filter_obj.getValue() !== '') {
|
||||||
that.__internal.buttons[1].element.disabled = false;
|
that.__internal.buttons[2].element.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
that.__internal.buttons[1].element.disabled = true;
|
that.__internal.buttons[2].element.disabled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -221,6 +245,15 @@ function initFilterDialog(alertify, pgBrowser) {
|
|||||||
e
|
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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user