Update just one row

Update just one row

Samantha1999Samantha1999 Posts: 4Questions: 0Answers: 0

Hi, is there a method for updating just one row of a table when the data option is updated?


  • colincolin Posts: 14,618Questions: 1Answers: 2,497

    Is this using Editor? I'm not too clear what you mean by "when the data option is updated" - please can you expand.


  • rf1234rf1234 Posts: 2,524Questions: 79Answers: 369

    Just like Colin I am not 100% sure I understand your problem. I am assuming you have an ajax sourced table and you don't want to reload the entire table because of just one previous update.

    I have a similar situation: I want to avoid an ajax relad of my contract table and hence do a proprietary ajax call in order to retrieve certain cell values. On "success" I update table cells directly and also the data source of one particular field in order to make sure calculations done with this field are done properly. That was the most difficult thing for me: Understanding that updating a cell doesn't automatically mean that the data source Datatables / Editor uses to supply the field values is being updated as well.

    var selected = contractTable.row({selected: true});
    //avoid ajax reload of contract table for performance reasons
    //econ_end_date may have been affected by the last changes and the 
    //cashflow generation!
        type: "POST",
        url: 'actions.php?action=getFormatterMaxExpAndBeginDates',
        data: {
            contractId:    selected.data().contract.id 
        dataType: "json",
        success: function (d) {
            contractTable.cell(selected, ".mED").data(d.maxExpDate).draw();
            contractTable.cell(selected, ".eeD").data(d.econ_end_date).draw();
            //update the data source of the hidden editor field calc_econ_end_date
            selected.data().contract.calc_econ_end_date = d.calc_econ_end_date;

    Please see this as well:

Sign In or Register to comment.