# Handlerbarjs in Visual Builder not allowing control when there is no data

**URL:** https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069
**Category:** Kibana
**Created:** [October 4, 2018, 3:31pm UTC](https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069 "2018-10-04T15:31:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rouble](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rouble/32/34283_2.png) [@rouble](https://discuss.elastic.co/u/rouble)
#### Post date: [October 4, 2018, 3:31pm UTC](https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069/1 "2018-10-04T15:31:25Z")

</div>

In a typical handlerbar js implementations the following code will result in the code in the else leg being hit if there is no data:

```
{{#if _all}}
{{else}}
    No widgets available
{{/if}}

```

However, Visual Builder hijacks the visualization and shows:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/1/018264b3588f372e01f23f28f8f8ddb228086023.png)

Same is true for the following handlebar js code/syntax as well:

```
{{#each _all}}
{{else}}
    No widgets available
{{/each}}

```

We need to be able to give endusers control of their displays if there is no data. This is a UX defect. If ES members agree, I can open a defect.

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [October 5, 2018, 2:26pm UTC](https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069/2 "2018-10-05T14:26:44Z")

</div>

hi @rouble,

I'm not 100% following. Are you injecting these handle-bar scripts in the markdown of TSVB?

TSVB doesn't have full handlebar scripting support, it just uses the handlebars for variable-substitution.

---

<div class="post-metadata">

### Author: ![rouble](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rouble/32/34283_2.png) [@rouble](https://discuss.elastic.co/u/rouble)
#### Post date: [October 5, 2018, 2:59pm UTC](https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069/3 "2018-10-05T14:59:01Z")

</div>

Yes @thomasneirynck. Think of the usecase where a user wants to control the markdown visualization if there is no data in \_all. Currently, TSVB will hijack the visualization and show  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8d38ef67332a00578d991632b7c7ddfdaea89fd2.png)

But that is crude. What if I wanted to just have some text saying, 'No widgets available' or do something totally different if there is no data. Handlebar js syntax has a common way of allowing this feature via the {{else}} tag.

I understand that TSVB does not have full support for handlerbar js, but it would be nice to allow developers to control the markdown of a visualization when there is no data.

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [October 6, 2018, 6:49pm UTC](https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069/4 "2018-10-06T18:49:13Z")

</div>

hi @rouble,

thanks, I understand better now. This sounds like an enhancement request for TSVB actually. I would submit one here: [http://github.com/elastic/kibana/new](http://github.com/elastic/kibana/new)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 3, 2018, 6:49pm UTC](https://discuss.elastic.co/t/handlerbarjs-in-visual-builder-not-allowing-control-when-there-is-no-data/151069/5 "2018-11-03T18:49:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
