Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Dynamically getting values based on data-id #747

Open
uppak opened this issue Jul 11, 2017 · 2 comments
Open

Dynamically getting values based on data-id #747

uppak opened this issue Jul 11, 2017 · 2 comments

Comments

@uppak
Copy link

uppak commented Jul 11, 2017

Hi,

I have been working very recently with the dashing framework. I was displaying a list of tasks assigned to a team. Till now, It was only one team to list and no issues so far. Now I have a set of teams & I want to display data based on data-id from .erb file. For example, the below is my erb sample.

<html>
<li data-switcher-interval="20000" data-row="2" data-col="3" data-sizex="2" data-sizey="1">
     <div data-id="Team A" data-view="List" data-title="Bugs Trend for Team A" data-moreinfo=""  data-top-margin="10"></div></li>
</html>

I wrote a scheduled job to get the list of all teams into an array in jobs.rb. Is there a way to send data-id to jobs.rb file, so I can filter the values from the array and call the event.

Regards,
Kalyan

@slowjoe007
Copy link

slowjoe007 commented Jul 13, 2017

Hi Kalyan,
maybe I missed it, but where is the dynamic part of it?
If you specify a static ID in your .erb file, then you always will see the data for that ID, e.g. Team A in your example.
What is your goal?

  1. A single widget showing the tasks of all teams, e.g. rotating (showing one team at a time)
  2. A dedicated widget for each team
  3. A widget on a universal dashboard that displays the tasks of a team based on some context information

(1) and (2) are trivial. For (1) you can send the corresponding data by the server's background job on a schedule. For (2) you would have a dedicated widget ID for each widget and the job sends the corresponding data to the widget IDs.

For (3) you could work with a request parameter that dynamically sets the ID of the widget in the .erb file, e.g. data-id="tasklist_<%= params[:team] %>". The background job would send data (send_event) to IDs it can generate from the data it read, e.g. targetWidgetID = "tasklist_" + $team.

Hope this helps,
Johannes

@Diluke
Copy link

Diluke commented Sep 23, 2017

Check this Dashing Workshop from Monitorama, Part about data binding at ~30min mark might solve your question.
https://vimeo.com/95307499

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants