# CustomDataSource - Change entity.polygon outline after entityCollection hide and show

**URL:** <https://community.cesium.com/t/customdatasource-change-entity-polygon-outline-after-entitycollection-hide-and-show/5876>\
**Category:** CesiumJS\
**Created:** [July 28, 2017, 11:02am UTC](https://community.cesium.com/t/customdatasource-change-entity-polygon-outline-after-entitycollection-hide-and-show/5876 "2017-07-28T11:02:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monisha](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@Monisha](https://community.cesium.com/u/Monisha)\
**Post date:** [July 28, 2017, 11:02am UTC](https://community.cesium.com/t/customdatasource-change-entity-polygon-outline-after-entitycollection-hide-and-show/5876/1 "2017-07-28T11:02:42Z")

</div>

\*\*Hi guys, \*\*

**I am trying to change the entity.polygon.outline of a custom datasource onclick. Everything works fine except for the first change done to the entity.polygon.outline after datasource show property is changed. Cesium version : 1.32**

**Sample to show the problem:**

**var dataSource = new Cesium.CustomDataSource();**

**var entities = dataSource.\_entityCollection.values;**

**dataSource.\_entityCollection.add(new Cesium.Entity({**

**polygon : {**

**hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -115.0, 32.0,**

**-107.0, 33.0, -102.0, 31.0, -102.0, 35.0]),**

**material : Cesium.Color.RED.withAlpha(0.35),**

**outline: true,**

**height: 1**

**}**

**}));**

**setTimeout(function(){**

**entities[0].polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.RED); // Works**

**}, 5000);**

\*\*setTimeout(function(){ \*\*

**dataSource.show = false;dataSource.show = true;console.log(‘Datasource : show’);**

**}, 10000);**

**setTimeout(function(){**

**entities[0].polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.BLACK); // Doesnot work**

**}, 15000);**

**setTimeout(function(){**

**entities[0].polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.BLACK); // Works**

**}, 20000);**

**//Create a Viewer instances and add the DataSource.**

**var viewer = new Cesium.Viewer(‘cesiumContainer’, {**

**animation : false,**

**timeline : false**

**});**

**viewer.clock.shouldAnimate = false;**

**viewer.dataSources.add(dataSource);**

**Could someone help me with this?**

**Thanks in advance,**

**Monisha**

---

<div class="post-metadata">

**Author:** ![Rachel\_Hwang](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rachel\_Hwang](https://community.cesium.com/u/Rachel_Hwang)\
**Post date:** [July 28, 2017, 3:29pm UTC](https://community.cesium.com/t/customdatasource-change-entity-polygon-outline-after-entitycollection-hide-and-show/5876/2 "2017-07-28T15:29:08Z")

</div>

Hi Monisha,

Unfortunately, this is a known bug that we haven’t gotten a chance to fix yet. There’s an issue for it open here: [https://github.com/AnalyticalGraphicsInc/cesium/issues/5371](https://github.com/AnalyticalGraphicsInc/cesium/issues/5371)

I’ve linked to this post so we can update you when we address it.

In the meanwhile, hopefully you can find a workaround – if you’re not doing anything too performance heavy you could for instance swap out the entity for just a new one entirely with a new color (although this will be more costly).

Hope that helps,

- Rachel
