How to do server side API

How to do server side API

lukesweet08lukesweet08 Posts: 3Questions: 0Answers: 0
edited August 2010 in General
Hey everyone,
So I got the DataTables to work and I gotta say, they look great. However, I'm trying to implement some of the API functions onto the table such as fnAddData and fnDeleteRow, but the problem is that I'm doing server side processing. I realize that I need to call these functions onto the server since DataTables doesn't know if the data is coming from client side or server side. I was just wondering if I could get some help on doing this. I'm currently doing this through an ajax source, and I just want to know where to put the functions so they call them to the server. Thanks!

Replies

  • lukesweet08lukesweet08 Posts: 3Questions: 0Answers: 0
    Oh and I don't have any of the server side PHP code put it. It draws up the table without it, so I figured I didn't need it. Do I need to put that in so I can use the API functions?
  • lukesweet08lukesweet08 Posts: 3Questions: 0Answers: 0
    And thirdly, I'm using the ColdFusion scripts for the server side processing
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The API functions such as fnDeleteRow and fnAddData are (frankly) mostly useless when it comes to server-side processing - for the reasons you point out: the data store is the server, not DataTables, so telling DataTables that there is a new row isn't going to do any good - tell the server and reload the table.

    So my advice would be to forgot using the API functions for data manipulation when server-side processing, and just make an XHR call to the server to add / delete rows as required (obviously the server-side scripts would need to cope with that) - then call fnDraw() on the table to have it redraw with the new data.

    Allan
This discussion has been closed.