views:

1635

answers:

3

My two highest priorities are progressive enhancement and inline editing. I've found progressive enhancement (DataTables) and inline editing (jqGrid), but not both. Support for jQuery UI themes would be nice, but is a lower priority.

Thanks.

UPDATE: Here's an example of what I'm imagining the solution would resemble:

<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>
+4  A: 

I think jqGrid would be a pretty good fit.

UPDATE:

You can use code like this to convert your table to a javascript object

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
});

and then tack it on like in the loading array data example

for(var i=0;i<=data.length;i++) $("#datagrid").addRowData(i+1,data[i]);
Jesse Kochis
How do I create a jqGrid from a `table` full of data?
Hank Gay
Do you mean html table or database table?
Jesse Kochis
If you can supply the source code you are working with, I can help you better.
Jesse Kochis
I mean an html table. I want to send the data down with the initial response as a semantically correct `table`. Then I want to use jQuery to fancy it up and provide inline-editing capabilities. Reading through the jqGrid docs, I was left with the distinct impression that there was no way to take a `table` tag that already had all the data and create a jqGrid from it.
Hank Gay
Try it with the example I've provided now. You'll want to make it more robust probably. Like loop the <th> to make the columns, but I think the code above should help.
Jesse Kochis
Clever. I was thinking of something more out-of-the-box, but I can probably make this work. Thanks.
Hank Gay
A: 

Check out Flexgrid.

Nick Riggs
I don't think Flexgrid supports inline editing.
Jesse Kochis
Ugh - you are correct, it doesn't.
Nick Riggs
+1  A: 

With the latest release of jqGrid, we now get tableToGrid, which solves the grid-from-markup problem quite nicely.

Hank Gay