1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| var arrayUpdate = new Array();
var myHeaders = ["ID","De ()","à ()","je gagne! (%)"];
var myCells = [
<?php
$host="localhost";
$name="root";
$pass="";
$db="save_grid";
$dbcon=mysql_connect ("$host", "$name", "$pass") or die;
if (mysql_errno() == 1203 or mysql_errno() == 1040) {
echo "ERREUR: Le serveur est trop occupé";
exit;
}else{
mysql_select_db ($db);
}
$result = mysql_query("SELECT * from table_marges order by id",$dbcon);
$rows = "";
while(list($id, $marge_min, $marge_max, $my_marge)=mysql_fetch_row($result)){
$rows .= "['$id','$marge_min','$marge_max','$my_marge'],";
}
echo substr($rows,0,-1);
?>
];
var parametre = new AW.UI.Grid;
parametre.setId("Grid_parametre");
parametre.setHeaderText(myHeaders);
parametre.setCellText(myCells);
parametre.setColumnCount(myHeaders.length);
parametre.setRowCount(myCells.length);
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
parametre.setCellFormat([num, str, str, str]);
parametre.setSelectorVisible(true);
parametre.setSelectorText(function(i){return this.getRowPosition(i)+1});
parametre.setSelectorWidth(28);
parametre.setHeaderHeight(20);
parametre.setCellEditable(true);
parametre.onCellValidated = function(text, col, row){
var id = parseFloat(this.getCellText(0, row));
var TheName = this.getCellText(1, row);
var Themarge_max = this.getCellText(2, row);
var Themy_marge = this.getCellText(3, row);
var ar = new Array(id,TheName,Themarge_max,Themy_marge);
arrayUpdate[id] = ar;
} |
Partager