salve a tutti, ho scritto il seguente codice per visualizzare una tabella html tramite jqGrid.
Ora vorrei implementare le funzioni di edit, update e delete rendendo le modifiche stabili su DB. Come posso fare per esempio una aggiunta di un nuovo record tramite AJAX ?
codice:<HTML> <head> <link rel="stylesheet" type="text/css" media="screen" href="jquery-ui-1.8.5.custom.css" /> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="grid.locale-it.js" ></script> <script type="text/javascript" src="jquery.jqGrid.min.js"></script> <script type="text/javascript" src="jquery-ui-1.8.5.custom.min.js"></script> <script type="text/javascript"> jQuery(document).ready(function(){ tableToGrid("#distTable", { autowidth: true, shrinkToFit: false, sortable: true, pager: "#pager", rowNum: 10, rowList: [10, 20, 30], sortname: "Name", viewrecords: true, sortorder: "asc", colModel: [{name: 'Name', id: 'Name', editable: true, key: true}, {name: 'Size', id: 'Size', editable: true}, {name: 'Platform', id: 'Platform', editable: true} ], colName: ['Name', 'Size', 'Platform'] }); jQuery('#distTable').navGrid('#pager', {add: true, edit: true, del: true} ); jQuery('#distTable').trigger('reloadGrid'); }); </script> </head> <body> <table id="distTable" cellspacing="0" cellpadding="1" border="1"> <thead> <tr> <th>Name</th> <th>Platform</th> <th>Size</th> </tr> </thead> <tbody> <tr> <td>Chatter</td> <td>PC</td> <td>123</td> </tr> </tbody> </table> <div id="pager"></div> </body> </html>

Rispondi quotando