read $aaData

read $aaData

pakypaky Posts: 106Questions: 0Answers: 0
edited September 2012 in General
how do I read the json string generated by the server even after it has been rendered (datatable)? thanks

Replies

  • pakypaky Posts: 106Questions: 0Answers: 0
    I have a button to print the data, and I wanted to re-read the string json, can you?
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    The fnGetData method sounds ideal for this.
  • pakypaky Posts: 106Questions: 0Answers: 0
    thanks allan ;)
  • pakypaky Posts: 106Questions: 0Answers: 0
    Allan can I retrieve only json response from ajax-source datatable ? Without html tag added by me in fnRender() func ?

    tnx ;)
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Yes - fnGetData gives you the data. If you want nodes, then you can use fnGetNodes . See: http://datatables.net/api
  • pakypaky Posts: 106Questions: 0Answers: 0
    Ok, if I want read all rows where first checkbox is checked ? Without this function ... ?
    [code]
    oTable.$('tr').click( function () {
    var data = oTable.fnGetData( this );
    // ... do something with the array / object of data for the row
    } );
    [/code]

    .... any suggestions? ^^
  • pakypaky Posts: 106Questions: 0Answers: 0
    Great I've found old discussion ! And retrieve all rows (where checked=true) with
    [code]
    $(\'input:checked\', table.fnGetNodes()).each(function(i){
    //appendMyJSON(myJSON, table.fnGetData(i));
    r = table.fnGetData(i);
    console.log(r);
    });
    [/code]

    how can I clean the values ​​returned by the html tags? thanks
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    There is a nicer way to do it these days:

    [code]
    table._('input:checked');
    [/code]

    will give you an array of the values which are checked.

    [code]
    table.$('input:checked');
    [/code]

    Will give you the input elements which are checked.

    Allan
  • pakypaky Posts: 106Questions: 0Answers: 0
    thanks Allan, I interested to all row, entire , where first cell (with checkbox are checked)
This discussion has been closed.