Please help me find a solution!
Hi,
I'm trying to update a grid, i.e. Add a new line from fields on the form, using grid.Refresh() and I can't get it to work.
The code I have is follows:
<div id="barButtons">
<button id="btnAdd" onclick='addLineAJM()'>Add Line</button>
<button id="btnUpdate">Update Line</button>
<button id="btnRemove">Remove Line</button>
<button id="btnShowData" onclick='alert(lineData)'>Show Data</button>
</div>
<script type="text/javascript">
var lineData = [
["A","B","C","D","E","F","G"]
]
var lineColumns = [
"Line Number", "Item Code", "Product Description", "Quantity", "Unit Price", "Amount", "UNID"
]
var gridLines = new Active.Controls.Grid;
gridLines.setId( "linesGrid" );
gridLines.setRowProperty( "count", lineData.length);
gridLines.setColumnProperty( "count", 7 );
gridLines.setDataProperty( "text", function( i, j ){return lineData[i][j] } );
gridLines.setColumnProperty( "text", function( i ){ return lineColumns[i] } );
gridLines.setRowHeaderWidth("28px");
gridLines.setColumnHeaderHeight("20px");
gridLines.sort( 0, "ascending" );
document.write( gridLines );
function addLineAJM()
{
gridLines.setRowProperty("count", gridLines.getRowProperty("count") + 1);
lineData[lineData.length] = ["1", "1","1","1","1","1","1"];
gridLines.setDataProperty( "text", function( i, j ){return lineData[i][j] } );
gridLines.refresh();
}
</script>
As you can see, i've hard-coded the lines to be entered for the mean time, and when I click the "Show Data" button, the data has been added to the array ok (or I think it has).
i've tryed the following:
function addLineAJM()
{
rowData = ["1", "1","1","1","1","1","1"];
lineData.unshift(rowData);
gridLines.setRowProperty("count", 2);
gridLines.refresh();
}
and the data in the first line changes, but the second line (with the original data) is not shown.
Again, the data is added to the array (at the front), but the line count doesn't seem to update.
Can someone point me in the right direction please?
I'm trying to update a grid, i.e. Add a new line from fields on the form, using grid.Refresh() and I can't get it to work.
The code I have is follows:
<div id="barButtons">
<button id="btnAdd" onclick='addLineAJM()'>Add Line</button>
<button id="btnUpdate">Update Line</button>
<button id="btnRemove">Remove Line</button>
<button id="btnShowData" onclick='alert(lineData)'>Show Data</button>
</div>
<script type="text/javascript">
var lineData = [
["A","B","C","D","E","F","G"]
]
var lineColumns = [
"Line Number", "Item Code", "Product Description", "Quantity", "Unit Price", "Amount", "UNID"
]
var gridLines = new Active.Controls.Grid;
gridLines.setId( "linesGrid" );
gridLines.setRowProperty( "count", lineData.length);
gridLines.setColumnProperty( "count", 7 );
gridLines.setDataProperty( "text", function( i, j ){return lineData[i][j] } );
gridLines.setColumnProperty( "text", function( i ){ return lineColumns[i] } );
gridLines.setRowHeaderWidth("28px");
gridLines.setColumnHeaderHeight("20px");
gridLines.sort( 0, "ascending" );
document.write( gridLines );
function addLineAJM()
{
gridLines.setRowProperty("count", gridLines.getRowProperty("count") + 1);
lineData[lineData.length] = ["1", "1","1","1","1","1","1"];
gridLines.setDataProperty( "text", function( i, j ){return lineData[i][j] } );
gridLines.refresh();
}
</script>
As you can see, i've hard-coded the lines to be entered for the mean time, and when I click the "Show Data" button, the data has been added to the array ok (or I think it has).
i've tryed the following:
function addLineAJM()
{
rowData = ["1", "1","1","1","1","1","1"];
lineData.unshift(rowData);
gridLines.setRowProperty("count", 2);
gridLines.refresh();
}
and the data in the first line changes, but the second line (with the original data) is not shown.
Again, the data is added to the array (at the front), but the line count doesn't seem to update.
Can someone point me in the right direction please?
Charlie
August 25,