Question: I am using jQuery [Isotope](http://isotope.metafizzy.co/). It's a great plugin but I'm having a little issue with aligning the items in masonry mode. My container is 960px wide and my goal is to get 4 items to line up perfectly as if it were using the 960px grid system. So, both the left and right edges would be touching the the edge of the container. Here is a screen shot of how it looks at the moment:

![enter image description here](https://i.stack.imgur.com/qfOqO.png)

My code is currently like so:

**JS:**

```
$('#container').isotope({
  itemSelector : '.item',
      masonry : {
          columnWidth : 240,
          gutterWidth: 10
      }
});

```

**CSS:**

```
.item{
width:230px;
background:red;
overflow: hidden;
}

```

**HTML:**

```
 <div class="item">a</div>

```

So far the only way I have managed to get it to work is to set the width to `240px` but then there is no gap between the items.

**EDIT**

Here is a fiddle showing what I have <http://jsfiddle.net/qGJhe/>

Answer: 
You probably need to change the `DataSource.DataSet` instead:

```
procedure SetDataFromDataSet(const aDataSource: TDataSource;
  const aNewDataSet: TDataSet);
begin
  aDataSource.DataSet.Close;
  aDataSource.DataSet := aNewDataSet;
  if not aNewDataSet.Active then
    aNewDataSet.Open;
end;

```

Sample use:

```
SetDataFromDataSet(DataSource1, CustomerQuery); 

```

You may not want to close and open datasets globally like this, though. It's probably better to do that from the calling code. Of course, that would depend on what you need for your app.
Tested with Delphi5 pro.

```
procedure TForm1.setDataSourceDataSet(var newDataSource:TDataSource);
begin
if DBgrid1.DataSource = nil then begin
   DBgrid1.DataSource:=newDataSource;
end else begin
if DBgrid1.DataSource.Name = newDataSource.Name then exit;
DBGrid1.DataSource.Enabled:=False;
DBgrid1.DataSource:=newDataSource;
end;
If DBgrid1.DataSource.DataSet.active=False then DBgrid1.DataSource.DataSet.active:=True;
DBGrid1.DataSource.Enabled:=True;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
setDataSourceDataSet(DataSource1);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
setDataSourceDataSet(DataSource2);
end;

```