This should be so easy and yet...
The following code works just fine (I've trimmed away the info not needed here):
$(function()
{
.
..
...
// Defining the data options.
var datasetOptions =
{
fields: fieldArray,
recordType: 'array',
data: rowData
};
// Putting together the column options.
var columnOptions = new Array();
for (var i = 0; i < fieldNames.length; i++)
{
columnOptions.push({id: fieldNames[i], header: fieldNames[i], width: columnWidth});
}
// Defining the grid options.
var toolbar = 'filter state';
var gridOptions =
{
id: 'SigmaGridID',
container: 'SigmaGridDiv',
height: gridHeight,
pageSize: rowCount,
replaceContainer: true,
resizable: true,
selectRowByCheck: false,
showGridMenu : false,
showIndexColumn: false,
skin: "vista",
toolbarContent: toolbar,
toolbarPosition: 'bottom',
width: gridWidth,
dataset: datasetOptions,
columns: columnOptions
};
// Displaying the grid.
var grid = new Sigma.Grid(gridOptions);
Sigma.Util.onLoad(Sigma.Grid.render(grid));
});
When the page loads the grid is populated and all is good. But I don't want to have to reload the entire page everytime.
I've succeeded is repopulating the grid dynamically using:
var grid = Sigma.$grid("SigmaGridID");
grid.refresh(rowData);
Sigma.Grid.render(grid);
but this doesn't adjust the columns. So if I am adding a column the data is updated but there is a column missing. If I remove a column then the data is displayed but with the extra column all empty.
So. How do I adjust the columns or is there a way better way to dynamically re-render and re-display the Sigma Grid? In other words, how do we display the Sigma Grid but not only when the page is loading?
Thanks.
Michael