4

I have this problem: As you can see in the picture below, I am using a layout that has only one element in the first row but it has this weird right alignment issue (it extends too far right).

enter image description here

HTML
CSS

What is the problem?

Here is my first element:

<li data-row="1" data-col="1" data-sizex="15" data-sizey="3" >
  <div data-id="some-id" data-view="MyWidget" data-title="Some title" style="background-color:#749396"></div>
</li>

I am using this setup in application.coffee (15 columns, 9 rows, each column/row is 100 pixels wide):

Dashing.on 'ready', ->
  Dashing.widget_margins ||= [5, 5]
  Dashing.widget_base_dimensions ||= [100, 100]
  Dashing.numColumns ||= 15

When I specifically set the width on the li, it works.

<li data-row="1" data-col="1" data-sizex="15" data-sizey="3" style="width: 1640px;">

Here is the complete dashboard layout:

<% content_for :title do %>Dashboard<% end %>
<div class="gridster">
  <ul>

    <!-- Hack: Setting width of top row to 1640px! -->

    <li data-row="1" data-col="1" data-sizex="15" data-sizey="3" style="width: 1640px;">
      <div data-id="id1" data-view="OwnWidget" style="background-color:#749396"></div>
    </li>

    <li data-row="4" data-col="1" data-sizex="5" data-sizey="4">
      <div data-id="id2" data-view="Meter" data-min="0" data-max="100"></div>
    </li>

    <li data-row="4" data-col="6" data-sizex="5" data-sizey="4">
      <div data-id="id3" data-view="Number" style="background-color:#749396"></div>
    </li>

    <li data-row="4" data-col="11" data-sizex="5" data-sizey="4">
      <div data-id="id4" data-view="Number" style="background-color:#749396"></div>
    </li>

    <li data-row="8" data-col="1" data-sizex="5" data-sizey="4">
      <div data-id="id5" data-view="Meter" data-min="0" data-max="100"></div>
    </li>

    <li data-row="8" data-col="6" data-sizex="5" data-sizey="4">
      <div data-id="id6" data-view="Number" style="background-color:#749396"></div>
    </li>

    <li data-row="8" data-col="11" data-sizex="5" data-sizey="4">
      <div data-id="id7" data-view="Number" style="background-color:#749396"></div>
    </li>

  </ul>
</div>
meilke
  • 3,280
  • 1
  • 15
  • 31
  • Added the whole layout. – meilke Apr 04 '14 at 16:28
  • Have you tried to get different results if you change ` Dashing.widget_base_dimensions ||= [100, 300]` and assign the rows according to their real rows `data-row="1"` and `data-row="2"` for the second. I could imagine that it calculates the margins the wrong way. I see that you want to use different heights, but it might help to figure out the problem. – boxer santaros Apr 04 '14 at 17:16
  • Everything works fine height-wise. If I put in another element in the first row, the margins will be calculated correctly, both horizontally and vertically. The problem only shows when you have a *single* element in the first row. – meilke Apr 04 '14 at 18:11
  • can u share any link? – G.L.P Apr 07 '14 at 05:36
  • Unfortunately, I cannot provide a hosted example right now. – meilke Apr 07 '14 at 06:53
  • Could you post an example on [jsfiddle](http://jsfiddle.net/)? – Sandy W Apr 07 '14 at 19:07
  • It would be helpful if you'll provide the css. A jsfiddle example perhaps. – jinmichaelr Apr 08 '14 at 05:01