Spanglish
Spanglish

Reputation: 119

Creating widgets for dashing

I`m trying to create a widget for dashing (http://shopify.github.io/dashing/) for displaying 4 values:

value1 value2 value3 value4

I have copied the contents of the text widget and added the following to the widget.html

<h3 data-bind="text | raw"></h3>

<p class="more-info" data-bind="moreinfo | raw"></p>
<p class="value1" data-bind="value1"></p>
<p class="value2" data-bind="value2"></p>
<p class="value3" data-bind="value3"></p>
<p class="value4" data-bind="value4"></p>
<p class="updated-at" data-bind="updatedAtMessage"></p>

When I add this widget to my dashboard using:

      <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
  <div data-id="mywidget" data-view="mywidget" data-title="Grupserhs" data-text="Systems Dashboard" data-moreinfo="Hello"></div>
     </li>

Yet I have a blank page in my dashboard.

What would be the correct way to create a widget that will only receive pushed data?

Thanks in advance.

Upvotes: 2

Views: 4835

Answers (3)

Larry Cai
Larry Cai

Reputation: 60083

From the current information, in the dashboard, it shall using like

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
  <div data-id="mywidget" data-view="mywidget" data-title="Grupserhs" data-text="Systems Dashboard" data-moreinfo="Hello" data-value1="first value" data-value2="this is value2" data-value3="value3" data-value4="last value" ></div>
</li>

The data-bind="value1" shall be mapped into dashboard like data-value1

It may have other problems, like putting those widget in separate folder, your css format. Please provide more detail file list for reference if it can't solve it.

Upvotes: 0

genus
genus

Reputation: 332

Do you have a coffeeScript file that defines your widget class and extends Dashing.Widget? You don't need anything else in there to start, but that is where your widget is defined. Also, do you have a job pushing data to this widget id "mywidget"? If not, look in the jobs folder, same level as widgets folder to get an idea, basically a Rufus scheduler task to pump data to your widgets. ..and don't forget to check the css for your widget..

Upvotes: 0

sam
sam

Reputation: 335

Actually use "list" widget for this. Look at the 'buzzwords.rb' file for an idea.

Upvotes: 1

Related Questions