mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Ensure we never sort columns on the treeview. Fixes #2185
This commit is contained in:
parent
b961b2d929
commit
c0f2aab001
@ -34,9 +34,13 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
};
|
||||
|
||||
var processTreeData = function(payload) {
|
||||
var data = JSON.parse(payload).data.sort(function(a, b) {
|
||||
return pgAdmin.natural_sort(a.label, b.label, {'_type': a._type});
|
||||
});
|
||||
var data = JSON.parse(payload).data;
|
||||
if (data.length && data[0]._type !== 'column' &&
|
||||
data[0]._type !== 'catalog_object_column') {
|
||||
data = data.sort(function(a, b) {
|
||||
return pgAdmin.natural_sort(a.label, b.label);
|
||||
});
|
||||
}
|
||||
_.each(data, function(d){
|
||||
d._label = d.label;
|
||||
d.label = _.escape(d.label);
|
||||
@ -868,7 +872,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
d = ctx.t.itemData(i);
|
||||
if (
|
||||
pgAdmin.natural_sort(
|
||||
d._label, _data._label, {'_type': d._type}
|
||||
d._label, _data._label
|
||||
) == 1
|
||||
)
|
||||
return true;
|
||||
@ -893,7 +897,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
d = ctx.t.itemData(i);
|
||||
if (
|
||||
pgAdmin.natural_sort(
|
||||
d._label, _data._label, {'_type': d._type}
|
||||
d._label, _data._label
|
||||
) != -1
|
||||
)
|
||||
return true;
|
||||
@ -901,7 +905,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
d = ctx.t.itemData(i);
|
||||
if (
|
||||
pgAdmin.natural_sort(
|
||||
d._label, _data._label, {'_type': d._type}
|
||||
d._label, _data._label
|
||||
) != 1
|
||||
)
|
||||
return true;
|
||||
@ -910,7 +914,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
d = ctx.t.itemData(i);
|
||||
if (
|
||||
pgAdmin.natural_sort(
|
||||
d._label, _data._label, {'_type': d._type}
|
||||
d._label, _data._label
|
||||
) == 1
|
||||
) {
|
||||
s = m + 1;
|
||||
|
@ -40,11 +40,6 @@
|
||||
oFxNcL, oFyNcL,
|
||||
mult = options.desc ? -1 : 1;
|
||||
|
||||
// If object is of column type then do not sort
|
||||
if (options.hasOwnProperty("_type") && options._type &&
|
||||
(options._type == 'column' || options._type == 'catalog_object_column'))
|
||||
return 0;
|
||||
|
||||
// first try and sort Hex codes or Dates
|
||||
if (yD)
|
||||
if ( xD < yD ) return -1 * mult;
|
||||
|
Loading…
Reference in New Issue
Block a user