Browse Source

ObjectDisplay: update body content from category update

master
parent
commit
d6d5dd28ed
  1. 12
      src/ObjectDisplay.js

12
src/ObjectDisplay.js

@ -4,6 +4,8 @@ const displayBlock = require('./displayBlock')
module.exports = class ObjectDisplay {
constructor ({feature, category, dom, displayId, fallbackIds}, callback) {
this.category = category
if (!fallbackIds) {
fallbackIds = []
}
@ -49,6 +51,13 @@ module.exports = class ObjectDisplay {
body.innerHTML = result
feature.sublayer.updateAssets(body, feature)
})
category.on('update', this.updateListener = () => {
category.renderTemplate(feature, displayId + 'Body', (err, result) => {
body.innerHTML = result
feature.sublayer.updateAssets(body, feature)
})
})
displayBlock({
dom,
@ -104,6 +113,9 @@ module.exports = class ObjectDisplay {
}
close () {
if (this.updateListener) {
this.category.off('update', this.updateListener)
}
}
}

Loading…
Cancel
Save