How to change the data binding without server refresh
Hi Alex,
Love your grid. I have spent a great dealof time also building a great looking grid using CSS. It doesn't have the databinding aspects (I use an intermediate XSL transform as an interface between the 'base data structure' and the xml layout structure for the grid proper. I have had some great luck with 'floating' columns so that no column prep is necessary as well. I would love to get with you sometime to see if there is anything I can contribute to your effort.
My question to you. I seem to be having troubles manipulating the datasource on the client side and then getting the grid refreshed with the new data. In particular I am building a mapping application where I show two grids side by side and give the user the ability to drag the fields from one grid to the other. I am prototyping with array based data right now. For some reason I can't get the grid to refresh itself on the new data. A simplified code snippet follows...
var grid = new Active.Controls.Grid;
var data1 = [["1020", "Daytona 500"], ["1030", "Pepsi 500"]];
grid.setRowCount(2);
grid.setColumnCount(2);
grid.setDataText(function(i, j){return data1[i][j]});
function deleteRow(){
var data2 = [["1020", "Daytona 500"]];
grid.setDataText(function(i, j){return data2[i][j]});
grid.refresh();
}
<button onClick="deleteRow()">Why can't I delete a row?</button>
Love your grid. I have spent a great dealof time also building a great looking grid using CSS. It doesn't have the databinding aspects (I use an intermediate XSL transform as an interface between the 'base data structure' and the xml layout structure for the grid proper. I have had some great luck with 'floating' columns so that no column prep is necessary as well. I would love to get with you sometime to see if there is anything I can contribute to your effort.
My question to you. I seem to be having troubles manipulating the datasource on the client side and then getting the grid refreshed with the new data. In particular I am building a mapping application where I show two grids side by side and give the user the ability to drag the fields from one grid to the other. I am prototyping with array based data right now. For some reason I can't get the grid to refresh itself on the new data. A simplified code snippet follows...
var grid = new Active.Controls.Grid;
var data1 = [["1020", "Daytona 500"], ["1030", "Pepsi 500"]];
grid.setRowCount(2);
grid.setColumnCount(2);
grid.setDataText(function(i, j){return data1[i][j]});
function deleteRow(){
var data2 = [["1020", "Daytona 500"]];
grid.setDataText(function(i, j){return data2[i][j]});
grid.refresh();
}
<button onClick="deleteRow()">Why can't I delete a row?</button>
Wade
January 26,