feat: allow to define sortKey at layer level (#2449)

In some situation, we do not want the same sortKey for each layer.
This commit is contained in:
Yohan Boniface 2025-01-27 10:08:53 +01:00 committed by GitHub
commit d4afd5646f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -462,7 +462,7 @@ export class DataLayer extends ServerStored {
} }
sortFeatures(collection) { sortFeatures(collection) {
const sortKeys = this._umap.getProperty('sortKey') || U.DEFAULT_LABEL_KEY const sortKeys = this.getOption('sortKey') || U.DEFAULT_LABEL_KEY
return Utils.sortFeatures(collection, sortKeys, U.lang) return Utils.sortFeatures(collection, sortKeys, U.lang)
} }
@ -731,11 +731,17 @@ export class DataLayer extends ServerStored {
'options.zoomTo', 'options.zoomTo',
'options.fromZoom', 'options.fromZoom',
'options.toZoom', 'options.toZoom',
'options.sortKey',
] ]
builder = new MutatingForm(this, optionsFields, { builder = new MutatingForm(this, optionsFields, {
id: 'datalayer-advanced-properties', id: 'datalayer-advanced-properties',
}) })
builder.on('set', ({ detail }) => {
if (detail.helper.field === 'options.sortKey') {
this.reindex()
}
})
const advancedProperties = DomUtil.createFieldset( const advancedProperties = DomUtil.createFieldset(
container, container,
translate('Advanced properties') translate('Advanced properties')