1

我的兩個最高優先級是漸進增強和內聯編輯。我發現了漸進式增強功能(DataTables)和內嵌編輯(jqGrid),但不是兩種。支持jQuery UI主題會很好,但優先級較低。什麼是最接近YUI的DataTable的jQuery近似?

更新:這就是我想象中的解決方案將類似於的例子:

<table summary="A table full of example tabular data"> 
    <caption>My Table to Progressively Enhance</caption> 
    <thead> 
    <tr> 
     <th id="colA">Column A</th> 
     <th id="colB">Column B</th> 
    </tr> 
    </thead> 
    <tbody> 
    <tr> 
     <td headers="colA">foo</td> 
     <td headers="colB">bar</td> 
    </tr> 
    <tr> 
     <td headers="colA">argle</td> 
     <td headers="colB">bargle</td> 
    </tr> 
    </tbody> 
</table> 

… insert jquery datatable stuff here … 

<script type="text/javascript"> 
    progressivelyEnhanceMyTable(); 
</script> 

回答

2

隨着最新發布jqGrid,我們現在得到tableToGrid,很好地解決了網格標記問題。

5

我覺得jqGrid將是一個非常不錯的選擇。

UPDATE:

您可以使用這樣的代碼到你的表格轉換爲JavaScript對象

var $table = $('table'); // select your table 
var data = []; // instantiate the data array 
$('tr', $table).each(function(i, item){ // loop through the table rows 
    obj = {} // create the object to append to the data array 
    obj.name = $('td:eq(0)',$(this)).text().trim(); 
    obj.desc = $('td:eq(1)',$(this)).text().trim(); 
    data += obj; // add the object to the array 
}); 

,然後把它釘住像loading array data example

for(var i=0;i<=data.length;i++) $("#datagrid").addRowData(i+1,data[i]); 
+0

如何從充滿數據的`table`中創建一個jqGrid? – 2009-07-24 12:18:39

相關問題