:: Documentation >>

Saving changed cells

Here is a simplified example how one can save changes in editable grid to the server. The code sends the modified cells to the server cell-by-cell using onCellValidated event. To finish it you have to implement updateSingleCell.php or .asp or whatever server-side code which will actually save the data. The server-side script is called via POST method with three arguments (column, row, text).

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

    var myCells = [
        ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
        ["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"],
        ["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420", "28961"]
    ];

    var myHeaders = [
        "Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"
    ];

    var obj = new AW.UI.Grid;

    obj.setCellText(myCells);
    obj.setHeaderText(myHeaders);
    obj.setColumnCount(5);
    obj.setRowCount(3);

    obj.setCellEditable(true);

    obj.onCellValidated = function(text, column, row){

        var r = new AW.HTTP.Request;
        r.setURL("updateSingleCell.php");
        r.setRequestMethod("POST");
        r.setParameter("column", column);
        r.setParameter("row", row);
        r.setParameter("text", text);
        r.request();

        r.response = function(data){
            alert(data); // process response data
        }
    }

    document.write(obj);

</script>
</body>
</html>

Comments

Handle session values from struts Dhamin (0)
how can i get and save all data from a grid? beginner K. (1)
Grid Read XML, Edit Write XML Andy (1)
Changing data on a non editable cell (ie. toggle or dropdown cells) MR (0)
undocumented methods? (4)
"How to get the updated strings from the grid" deepthi (0)
Example - saving editable grid data to the server Alex (ActiveWidgets) (18)
Save the grid data at one time Kevin (8)
How do you relate the grid row to your data (Key)? Don Blaylock (1)
Fillters Sandesh Dube (0)
How can i save all the data in grid at once in struts (0)
How to save data from a grid in struts Vikramaditya Garg (8)
Confused about the purpose of validation event handlers on grid cells Quasar (2)
Changing data on a editable cell keeps it as editable mode till we click on other cell Vikramaditya Garg (0)
Does the POST send cookie info...? Garry Lindsay (0)
Good a chinese programer (0)

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5