progressive enhancement with jqgrid

SEO friendly

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http://trirand.com/blog/jqgrid/themes/ui.jqgrid.css">
<script src="http://trirand.com/blog/jqgrid/js/i18n/grid.locale-en.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/jquery.jqGrid.min.js"></script>
    <b>Here's an example of progressive enhancement with jqgrid:</b>
<ol style="font-size:10pt;">
    <li>1. SEO can see our table data (without running javascript)</li>
    <li>2. We have a progressively enhanced jqgrid, as you can see below</li>
    <li>3. Click a column header and the grid will begin to pull data remotely</li>
</ol>
<table id="grid">
    <tr><th>ID</th><th>State</th></tr>
    <tr><td>1</td><td>Alaska</td></tr>
    <!-- etc...this is for SEO... -->
</table>
<div id="pager"></div>

CSS

body { font-size:10pt; }

JavaScript

$("#grid").jqGrid({
	datatype:'local',
    // Server side script would probably dump this JSON out for first load...
    data: [{"id":1,"state":"Alabama"},
           {"id":2,"state":"Alaska"},
           {"id":3,"state":"Arizona"},
           {"id":4,"state":"Arkansas"},
           {"id":5,"state":"California"},
           {"id":6,"state":"Colorado"},
           {"id":7,"state":"Connecticut"},
           {"id":8,"state":"Delaware"},
           {"id":9,"state":"Florida"},
           {"id":10,"state":"Georgia"}],  
    localReader: {
         // These values should be generated server-side on first page load
         page: function(obj) { return 1; },
         total: function(obj) { return 5; }, 
         records: function(obj) { return 50; }
    },
	height: 250,
    width: 450,
   	rowNum:10,
   	colNames:['ID','State'],
   	colModel:[
   		{name:'id',index:'id', width:50},
   		{name:'state',index:'state', width:100}
   	],
   	caption: "States of the USA",
    pager: '#pager',
    viewrecords: true
});
$("#grid").jqGrid('navGrid', '#pager',{edit: false, add: false, del: false, search: false, refresh: true});         

   var data = {};
   var json = {page: "1", total:"5", records:"50", rows: []};
   json.rows = $('#grid').jqGrid('getGridParam', 'data');
   json.rows = $.extend(json.rows, [{"id":1,"state":"Remote data received...Now pager is correct"}]); 
   data.json = JSON.stringify(json);
   $('#grid').jqGrid("setGridParam",{datatype:"json", mtype:"POST", url:"/echo/json/"});
   $('#grid').jqGrid("setGridParam",{postData:data});