:: Forum >> Version 2 >>

last added row replace the one before....

Hi,

Something is happening...

When adding some row, it replaces the last one..!! what's happening
eg.1..adding value four

COLUMN
--------
one
two
three
four
four

eg.2..adding value grape

COLUMN
--------
orange
apple
grape
grape


The script:
<html>
<
head>
    <
script src="../../runtime/lib/aw.js"></script>
    <
link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</
head>
<
body>
<
style>

</
style>
<
script>
        var 
myColumns = [
            
"Ticker""Company Name""Market Cap.""$ Sales""Employees"
        
];
    </
script>
</
head>
<
body>
    <
script>

    
//    create ActiveWidgets Grid javascript object
    
var obj = new AW.UI.Grid;



    
//    provide cells and headers text
    
obj.setHeaderText(myColumns);

    
//    set number of rows/columns
    
obj.setRowCount(0);
    
obj.setColumnCount(3);

    
//    enable row selectors
    
obj.setSelectorVisible(true);
    
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});

    
//    set headers width/height
    
obj.setSelectorWidth(28);
    
obj.setHeaderHeight(20);

    
//    set row selection
    
obj.setSelectionMode("single-row");

    
//    set click action handler
    
obj.onCellClicked = function(eventcolrow){window.status this.getCellText(colrow)};

    
//    write grid html to the page
    
document.write(obj);

    
    
obj.onRowAdded = function(row){
        
window.status "Row added: " row;
        
this.setCellText(["new"0row]);
    }

    
obj.onRowDeleting = function(row){
        return !
confirm("Delete row " row "?");
    }

    
obj.onRowDeleted = function(row){
        
window.status "Row deleted: " row;
    }

    
    
// row index
    
var serial 1000;

    function 
add(){
        
obj.addRow(serial++);
    }

    function 
del(){
        var 
obj.getCurrentRow();
        
obj.deleteRow(i);
    }

</
script>
<
br>
<
button onClick="add()">add row</button>
<
button onClick="del()">delete row</button>

</
body>
</
html>
 
mysticav
Saturday, August 12, 2006



This topic is archived.

Back to support forum

Forum search