feat: allow to define sortKey at layer level

In some situation, we do not want the same sortKey for each layer.
This commit is contained in:
Yohan Boniface 2025-01-26 22:20:19 +01:00
parent ea2bdba270
commit 485bd94531

View file

@ -462,7 +462,7 @@ export class DataLayer extends ServerStored {
}
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)
}
@ -731,11 +731,17 @@ export class DataLayer extends ServerStored {
'options.zoomTo',
'options.fromZoom',
'options.toZoom',
'options.sortKey',
]
builder = new MutatingForm(this, optionsFields, {
id: 'datalayer-advanced-properties',
})
builder.on('set', ({ detail }) => {
if (detail.helper.field === 'options.sortKey') {
this.reindex()
}
})
const advancedProperties = DomUtil.createFieldset(
container,
translate('Advanced properties')