Visualizzazione dei risultati da 1 a 2 su 2

Discussione: aiuto con jqGrid

  1. #1

    aiuto con jqGrid

    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>
    Non ci sono Queen senza Freddie !

  2. #2
    Utente di HTML.it L'avatar di tapu
    Registrato dal
    May 2008
    Messaggi
    885
    http://www.trirand.com/blog/jqgrid/jqgrid.html

    vai nella sezione live data manipulation

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.