How make a list in the Info Window of a Fusion Map from a comma separated list?

104 views Asked by At

Can a cell with comma separated information be turned into a list? I've got uneven amounts of data (companies) and would like to just have it display as a basic List when the flag is clicked on in the Fusion Map.

Say I have:

Location: Seminole County, FL

Companies: Acme Co, Box Inc, Cogs LLC

------

Location: Orange County, FL

Companies: Acme Co, Dirt Inc, Shell Co

On Map it should be two flags, which it is. But how can I then have the companies displayed as a basic list?

I can go into the record and change it to contain the HTML:

Companies:<ul><li>Acme Co</li><li>Box Inc</li><li>Shell Co</li></ul

but that's pretty clunky. Is there a way to template it into the Custom Info Window to automate this:

Custom Info Window Layout - Google Fusion

I looked online but couldn't find anything and the Fusion User Group says to ask here.

Edit:

Based on first answer, my rows:

Fusion Rows

Resulting problem:

Fusion Map

1

There are 1 answers

4
Rod McChesney On BEST ANSWER

If you format the Companies values as JSON lists, you can loop over them with Closure templates. The latter are described in this help page, though the looping constructs are not currently documented.

First, go to Edit > Change columns and set the format of the Companies to JSON text. Then format your values as, say, ["Acme Co", "Dirt Inc", "Shell Co"]. Then in the Closure template you can loop over it it with

{template .contents}
...wrapper div and other columns if desired...
Companies:
<ul>
{foreach $company in $data.value.Companies}
<li>{$company}
{/foreach}
</ul>
...other stuff...
{/template}