Cita:
Iniciado por SirDuque Podes crear el array en PHP, enviarlo en JSON por Jquery, tiene el mismo formato.
Suerte!
Gracias SirDuque por responder. Nunca he trabajado con JSON y tengo muy poca experiencia con jQuery.
Lo que hago es trabajar siempre con PHP y AJAX. Te agradezco si tu ó alguien me puede guiar con este ejemplo. Cuando se descarga el código fuente, solo contiene dos archivos.
Uno tipo html y que se llama "
datagrid10_demo.html" y otro llamado "
datagrid_data.json". Este es el código que contienen:
Código HTML:
Ver original
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="jquery,ui,easy,easyui,web">
<meta name="description" content="easyui help you build your web page easily!">
<title>CheckBox select on DataGrid - jQuery EasyUI Demo
</title>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<h2>CheckBox select on DataGrid
</h2>
<div class="demo-info" style="margin-bottom:10px">
<div class="demo-tip icon-tip"> </div>
<div>Click on header checkbox to select or unselect all selections.
</div>
<table id="tt" title="Checkbox Select" class="easyui-datagrid" style="width:700px;height:250px"
url="data/datagrid_data.json"
idField="itemid" pagination="true"
iconCls="icon-save">
<th field="ck" checkbox="true"></th>
<th field="itemid" width="80">Item ID
</th>
<th field="productid" width="120">Product ID
</th>
<th field="listprice" width="80" align="right">List Price
</th>
<th field="unitcost" width="80" align="right">Unit Cost
</th>
<th field="attr1" width="200">Attribute
</th>
<th field="status" width="60" align="center">Stauts
</th>
Y el archivo JSON tiene el mismo código que presenté al inicio del Post:
Código Javascript
:
Ver original{"total":28,"rows":[
{"productid":"FI-SW-01","unitcost":10.00,"status":"P","listprice":16.50,"attr1":"Large","itemid":"EST-1"},
{"productid":"K9-DL-01","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},
{"productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Venomless","itemid":"EST-11"},
{"productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Rattleless","itemid":"EST-12"},
{"productid":"RP-LI-02","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Green Adult","itemid":"EST-13"},
{"productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":58.50,"attr1":"Tailless","itemid":"EST-14"},
{"productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":23.50,"attr1":"With tail","itemid":"EST-15"},
{"productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":93.50,"attr1":"Adult Female","itemid":"EST-16"},
{"productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":93.50,"attr1":"Adult Male","itemid":"EST-17"},
{"productid":"aaaaa","unitcost":92.00,"status":"P","listprice":193.50,"attr1":"Adult Male","itemid":"EST-18"}
]}
Como decía al principio, los datos que mostraré están en una base de datos MySQL. El plugin se ve muy útil y deseo poder aprovecharlo y creo q muchos de la comunidad les ayudaría.