Repeating Button for each space

Hello,

I have the following repeat div which query my database and retrieves all the rows queried as a button:

<div dmx-repeat:repeat1="QueryOCR.data.queryOCR">
									<button id="btn1" class="btn">{{text}}</button>
								</div>

the buttons:

What I need to do it’s to make each word a button, split a single button into multiple buttons. I’ve tried creating a repeat2 div inside the repeat1 splitting the text with /n but dindn’t work, it multiplied the buttons instead. Any ideas?

Thanks!

I did it using this code:

> <div class="form-group row">
> 							<div class="col-sm-10">
> 								<div dmx-repeat:repeat1="QueryOCR.data.queryOCR">
> 									<dmx-array id="arr1" dmx-bind:items="text.split('B')">
> 									</dmx-array>
> 									<div dmx-repeat:repeat2="arr1.items"><button id="btn1" class="btn" dmx-text="$value"></button></div>
> 								</div>
> 							</div>
> 						</div>

How do I apply multip[le conditions to the split? I need to split it on ‘B’, spaces (’ ') and ‘

did you try regex in split

example usage :

text.split(/\.|-/);
1 Like

Can you share the JSON that is returned by the server connect QueryOCR?
Seeing the actual value would help determine how to extract the exact information you are looking for to put in the repeat.

I could solve it. But now I’ve got this issue: Text to array using split, maybe you can help me

Answered in the above topic