Skip to content

Commit

Permalink
feat: allow to define sortKey at layer level (#2449)
Browse files Browse the repository at this point in the history
In some situation, we do not want the same sortKey for each layer.
  • Loading branch information
yohanboniface authored Jan 27, 2025
2 parents a2936d7 + 485bd94 commit d4afd56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion umap/static/umap/js/modules/data/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit d4afd56

Please sign in to comment.