:: Home >>

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

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

Comments will appear on this page and in the main forum.

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