Skip to content

Commit

Permalink
Sort keys in preview of featureHtml (#157)
Browse files Browse the repository at this point in the history
With this, every Popup shows the keys in the same order.
  • Loading branch information
tordans authored Jul 14, 2023
1 parent 7079615 commit dfe0dec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/preview-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ <h1>{{ .ID }}</h1>

// Convert feature properties into html
function featureHtml(f) {
var p = f.properties;
var sortedPropertyKeys = Object.keys(f.properties).sort((a,b) => a.localeCompare(b))
var h = "<p>";
for (var k in p) {
h += "<b>" + k + ":</b> " + p[k] + "<br/>"
}
sortedPropertyKeys.forEach(k => {
h += "<b>" + k + ":</b> " + f.properties[k] + "<br/>"
})
h += "</p>";
return h
}
Expand Down

0 comments on commit dfe0dec

Please sign in to comment.