Bonjour,

Pour un projet, je dois créer une page web qui permettra d'afficher un tableau de données.
Pour cela j'utilise la librairie UI OpenUI5.
Je suis loin d'être un pro en code donc je vais essayer de bien expliquer mon problème.
J'ai compris comment fonctionnait la création d'un tableau avec des données statiques par contre je sais pas du tout comment faire pour intégrer les données d'une BDD mysql.
Voici le script dans ma page html qui me permettra de mieux expliquer ensuite :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<script>  
// create the DataTable control
		var oTable = new sap.ui.table.Table({editable:false});
		// define the Table columns
		var oControl = new sap.ui.commons.TextView({text:"{lastName}"}); // short binding notation
		oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Last Name"}), template: oControl, sortProperty: "lastName", filterProperty: "lastName", width: "100px"}));
		oControl = new sap.ui.commons.TextView({text:"{name}"}); // more verbose binding notationt
		oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "First Name"}), template: oControl, sortProperty: "name", filterProperty: "name", width: "100px"}));
		oControl = new sap.ui.commons.CheckBox({checked:"{checked}"});
		oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Checked"}), template: oControl, sortProperty: "checked", filterProperty: "checked", width: "75px", hAlign: "Center"}));
		oControl = new sap.ui.commons.Link({text:"{linkText}", href:"{href}"});
		oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Web Site"}), template: oControl, sortProperty: "linkText", filterProperty: "linkText"}));
		oControl = new sap.ui.commons.RatingIndicator({value:"{rating}"});
		oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Rating"}), template: oControl, sortProperty: "rating", filterProperty: "rating"}));
 
		// create some local data
		var aData = [
			{lastName: "Dente", name: "Al", checked: true, linkText: "www.sap.com", href: "http://www.sap.com", rating: 4},
			{lastName: "Friese", name: "Andy", checked: true, linkText: "https://experience.sap.com/fiori", href: "https://experience.sap.com/fiori"},
			{lastName: "Mann", name: "Anita", checked: false, linkText: "http://www.saphana.com/", href: "http://www.saphana.com/", rating: 3},
		];
 
		// create a JSONModel, fill in the data and bind the Table to this model
		var oModel = new sap.ui.model.json.JSONModel();
		oModel.setData({modelData: aData});
		oTable.setModel(oModel);
		oTable.bindRows("/modelData");
 
		// finally place the Table into the UI
		oTable.placeAt("content");
 
</script>
Comme vous pouvez le voir les données du tableau sont en dur. Je souhaiterais faire une requête SQL et insérer ces données dans la variable aData.
Le problème n'est pas la requête bien entendu mais comment utiliser sql au milieu d'un script Javascript.
Merci d'avance