Il miglior tutorial menu ad albero jQuery EasyUI - griglia albero caricata dinamicamente Nel 2024, in questo tutorial puoi imparare Scarica esempi jQuery EasyUI,
Dinamicamente albero carico linee della griglia contribuiscono a caricare dati da la parte server, evitare di caricare grandi quantità di dati lunga attesa. Questo tutorial vi mostrerà come creare un albero con carico dinamico griglia caratteristica (TreeGrid).
<Tabella title = "Prodotti" class = stile "easyui-treegrid" = "width: 700px; height: 300px" url = "treegrid3_getdata.php" rownumbers = "true" idField = "id" treeField = "nome"> <Thead> <Tr> <Th campo = "Nome" width = "250"> Nome </ th> <Field Th = larghezza "quantità" = "100" align = "right"> Quantità </ th> <Field Th = larghezza "prezzo" = "150" align = formattatore "destra" = "formatDollar"> Prezzo </ th> <Field Th = "totale" width = "150" align = "right" formattatore = "formatDollar"> Totale </ th> </ Tr> </ Thead> </ Table>
treegrid3_getdata.php
$ Id = isset ($ _ POST [ 'id']) intval ($ _ POST [ 'id']): 0 ;? includere 'conn.php'; $ Risultato = array (); $ Rs = mysql_query ( "select * from prodotti dove parentId = $ id"); while ($ row = mysql_fetch_array ($ rs)) { ? $ Row [ 'stato'] = has_child ($ row [ 'id']) 'chiuso': 'aperto'; $ Row [ 'totale'] = $ row [ 'prezzo'] * $ row [ 'quantità']; array_push ($ risultato, $ row); } json_encode echo ($ result); Funzione has_child ($ id) { $ Rs = mysql_query ( "select count (*) da prodotti di cui parentId = $ id"); $ Row = mysql_fetch_array ($ rs); return $ row [0]> 0 vero :? falso; }