mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
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:
commit
d4afd5646f
1 changed files with 7 additions and 1 deletions
|
@ -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')
|
||||||
|
|
Loading…
Reference in a new issue