Allows you to use tables with the dashing framework
- Create a folder in your widgets folder called
table
. Insert the three files (table.coffee, table.scss, table.html)
or
dashing install 8eac8fe050bed362688f
- Create a widget on your dashboard with
data-view="Table"
- Create a job to populate the widget
To send a row to the tbody (or thead), send a JSON hash to rows
(hrows
for thead). The bindings work from row to column. Every column should be it's own array element off a cols
hash. The hash must have a key of "value"
in order to show up. To send multple rows, use an array of these hashes.
Some other keys that you use include colspan, rowspan, class, and style.
headers = {"cols"=>[{"value"=>"Name"}, {"value"=>"Value"}]}
rows = [{"cols"=>[{"value"=>"Name 1"}, {"value"=>"Value 1"}]},
{"cols"=>[{"value"=>"Name 2"}, {"value"=>"Value 2"}]},
{"cols"=>[{"value"=>"Name 3"}, {"value"=>"Value 3"}]},
{"cols"=>[{"value"=>"Name 4"}, {"value"=>"Value 4"}]}]
send_event("my-table", { hrows: headers, rows: rows } )
headers = {"style" => "color:#888" , "cols" => [ { "value" => "Name", "rowspan" => 2}, {"value" => "Value", "colspan" => 2} ] }
rows = [ {"cols" => [{"value" => "Name 1"}, {"value" => "Value 1"}]},
{"class" => "special", cols" => [{"value" => "Name 2"}, {"value" => "Value 2"}]},
{"rowspan" => 3, cols" => [{"value" => "Name 3"}, {"value" => "Value 3"}]},
{"style" => "text-transform:capitalize;", cols" => [{"value" => "Name 4"}, {"value" => "Value 4"}]} ]
send_event("my-table", { hrows: headers, rows: rows } )
- Uses an h1 tag for the title
Hi,
I have tried a few curl commands but I cannot make CURL commands work. I can send CURL commands to any of the demos but not the table at all. Can you post a quick example of what works for this exact example? (I tried the one that this project is forked from; but to no avail)
Thanks,
Roger