jQuery EasyUI prolongation - DWR loader
Il contient le fichier 'dwrloader.js de
Utilisez DWR pour obtenir les données, le premier à inclure les fichiers 'dwrloader.js de.
<Type Script = "text / javascript" src = "http://code.jquery.com/jquery-1.7.2.min.js"> </ script> <Type Script = "text / javascript" src = "http://www.w3cschool.cc/try/jeasyui/jquery.easyui.min.js"> </ script> <Type Script = "text / javascript" src = "dwrloader.js"> </ script>
La méthode DWR affectée à la propriété 'url'
Json comme chargeur par défaut, l'attribut 'url' indique l'URL json à distance pour obtenir des données.
Lorsque vous utilisez DWR chargeur, il faut assigner une fonction à la propriété 'url' pour obtenir les données de DWR.
L'exemple suivant montre comment utiliser DWR chargeur pour afficher la grille de données (DataGrid):
<Table id = "dg"> </ table> $ (Function () { $ ( '# Dg'). Datagrid ({ colonnes: [[ {Champ: "id", titre: 'ID', largeur: 80}, {Champ: "texte", titre: 'texte', largeur: 100} ]], singleSelect: true, autoRowHeight: false, largeur: 200, hauteur: 200, url: MyTest.getDataGridData }); });
code de test Java
public class Test { Liste publique <Carte <String, Object >> getDataGridData () { Liste <Carte <String, Object >> éléments = new ArrayList <Carte <String, Object >> (); Carte <String, Object> item = new HashMap <String, Object> (); item.put ( "id", 1); item.put ( "text", "text1"); Items.Add (point); article = new HashMap <String, Object> (); item.put ( "id", 2); item.put ( "text", "text2"); Items.Add (point); retourner les articles; } }
Télécharger exemples jQuery EasyUI
jQuery EasyUI Extended