Appending rows to Cesium infobox

1. A concise explanation of the problem you’re experiencing.

Hi all,

I am not able to add rows to infobox within a loop. Each time the infobox gets replaced instead of getting appended.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Below is a part of the code infobox. I am trying to append to the table by in the loop but the output doesnt get affected

var featureName = pickedFeature.getProperty(‘name’);

selectedEntity.name = featureName;

selectedEntity.description = 'Loading

';

viewer.selectedEntity = selectedEntity;

selectedEntity.description = ‘

’ +

’ +

’ +

’;

//trying to append rows to the infobox

for(var i=0;i<10;i++) {

selectedEntity.description.append = ‘

’ +

BIN ’ + pickedFeature.getProperty(‘BIN’) + ‘
DOITT ID ’ + pickedFeature.getProperty(‘DOITT_ID’) + ‘
SOURCE ID ’ + pickedFeature.getProperty(‘SOURCE_ID’) + ‘
SOURCE ID ’ + pickedFeature.getProperty(‘SOURCE_ID’) + ‘
’;

}

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

My requirement is to loop through and display as many rows in the infobox as the length of the loop.

4. The Cesium version you’re using, your operating system and browser.

cesium version I am using is 1.51, OS is windows 10 and browser is Chrome

  1. A concise explanation of the problem you’re experiencing.
  2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
  3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
  4. The Cesium version you’re using, your operating system and browser.

entity.description is a string, and append is not a function on JavaScript strings. That code should be giving you an error. You should be able to just concatenate strings by adding onto it, so:

entity.description = ‘

First Line

’;
entity.description += ‘

Second Line

’;

``