Search code examples
dashing

How to update data-text with send_event for data-view="Text"


Sorry, totally beginner of Dashing :(

I have these lines in my .erb file:

<li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
      <div data-id="welcome" data-view="Text" data-title="Godmorning team" data-text="Today SCRUM meeting is at 9:00" data-moreinfo="Protip: You can drag the widgets around!"></div>
 </li>

Now in my .rb file I want to have a schedueler say every 1h that update this data-id "welcome" with a new data-text, something like this:

SCHEDULER.every '1h' do
  dataTextToPresent = DataTextToPresent.getCurrentdataToPresent #returning a string
  puts dataTextToPresent #This print out "Today SCRUM meeting at new time, at 15:00"
  send_event('welcome', dataTextToPresent)

But I can not get this send_event call to work. How should the send_event call be designed to update the data-text with the new data in the variable dataTextToPresent?

BR!


Solution

  • You are not telling dashing to set text to your text, try this instead

    send_event('welcome', {text: dataTextToPresent})