Prevent call to server after adding a row

Prevent call to server after adding a row

alexgaalexga Posts: 1Questions: 1Answers: 0

I'm using a table with serverSide set to true. I don't want to make a call to the server every time I add a row via Ajax. I just want the table to locally refresh without making a call to the server every time there is a row added. Is this possible?

$('#addRow').on( 'click', function () {
        t.row.add( [
            counter +'.1',
            counter +'.2',
            counter +'.3',
            counter +'.4',
            counter +'.5'
        ] ).draw( false );
 
        ...
    } );

I would've had thought that the call to draw(false) would do the trick.

Thanks

Answers

  • kthorngrenkthorngren Posts: 20,315Questions: 26Answers: 4,771

    This thread discusses the same question.

    According to the draw() docs using false will do the following:

    full-hold or false - the ordering and search will be recalculated and the rows redrawn in their new positions. The paging will not be reset - i.e. the current page will still be shown.

    Even though the page doesn't change the sorting and searching function will send a request to the server.

    Kevin

This discussion has been closed.