From 3504afe84c9e73cdb61a575f7da4050a8464d3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Thu, 14 Sep 2023 23:10:56 +0200 Subject: [PATCH] Allow switching geometry type when editing in search views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Krög --- js/src/table/select.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/js/src/table/select.js b/js/src/table/select.js index 0dc0946ce4..f9bcd786ed 100644 --- a/js/src/table/select.js +++ b/js/src/table/select.js @@ -182,7 +182,7 @@ AJAX.registerOnload('table/select.js', function () { }); // Following section is related to the 'function based search' for geometry data types. - // Initially hide all the open_gis_editor spans + // Initially hide all the open_search_gis_editor spans $('span.open_search_gis_editor').hide(); $('select.geom_func').on('change', function () { @@ -251,13 +251,15 @@ AJAX.registerOnload('table/select.js', function () { var field = 'Parameter'; // Column type var geomFunc = $span.parents('tr').find('.geom_func').val(); - var type; - if (geomFunc === 'Envelope') { - type = 'polygon'; - } else if (geomFunc === 'ExteriorRing') { - type = 'linestring'; - } else { - type = 'point'; + var type = 'GEOMETRY'; + if (!value) { + if (geomFunc === 'Envelope') { + value = 'POLYGON()'; + } else if (geomFunc === 'ExteriorRing') { + value = 'LINESTRING()'; + } else { + value = 'POINT()'; + } } // Names of input field and null checkbox var inputName = $span.parent('td').children('input[type=\'text\']').attr('name');