ajax source doesnt add ID attribute to , so JEditable doesnt work.

ajax source doesnt add ID attribute to , so JEditable doesnt work.

jeff_porterjeff_porter Posts: 4Questions: 0Answers: 0
edited July 2011 in Bug reports
Hi,

ajax source doesnt add ID attribute to , so JEditable doesnt work.

Is this a know issue?

Thanks
Jeff Porter

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    if you have a backend database, using server processing is probably better than ajax source (however it does require more work to set up the sorting, filtering). I'm guessing this is why the ID was overlooked for ajax sourced data.

    You can add the id with a callback function of your own. Probably most suitable would be the fnRowCallback function.

    http://datatables.net/ref

    [code]
    // note: this is off the top of my head, haven't tested it.
    $(document).ready(function() {
    $('#example').dataTable( {
    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
    // assuming ID is in column 0
    $(nRow).attr("id", aData[0]);
    return nRow;
    }
    } );
    } );
    [/code]
  • jeff_porterjeff_porter Posts: 4Questions: 0Answers: 0
    cheers!
This discussion has been closed.