how do i do filter links with server side processing?

how do i do filter links with server side processing?

kimsiakimsia Posts: 14Questions: 0Answers: 0
edited January 2012 in General
Hi Allan,

thanks for helping me so far.

my datatable is now working. I can do paging, sorting, changing the length of the table while using server-side processing.

Now I need to do something like this.

a few links ABOVE the datatable. when they are clicked, the datatable is triggered to retrieve new records based on what links were clicked.

For eg if I am showing a datatable of products, I have 3 links that read. Show Visible, Show Hidden, Show All.

my datatable is orders and the field is called visible but is not amongst the 6 columns displayed, how do i make the 3 links work?

By the way I know jQuery.

Thank you.

Sorry I still cannot get my site up on the public net at the moment.

Replies

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    One method for doing this is to use fnServerParams and fnDraw .

    What to do is attach a click function to each of your links, which when clicked will set a variable indicating whatever extra data you want to sent to the server, so that your server-side script can then process that, and then call fnDraw - which will cause the table to be redraw with new data from the server.

    The fnServerParams function is then quite simply passing that variable that is been set (it will need to be scoped so it can be access from both fnServerParams and the click function) to the server.

    Allan
  • kimsiakimsia Posts: 14Questions: 0Answers: 0
    thanks for your help.

    I had a lot of trouble integrating multiple filter params and had to settle for good old normal GET request instead of ajax to do the filtering

    Another question:

    I noticed that in the themeforest theme i purchased where the table data were static in the html file, the sorting columns had displayed arrows using classes like sorting, sorting_desc, sorting_asc,

    in my server_processing which now works with sorting, the classes do not appear.

    They only appear if the data was static like the theme.

    Please advise.
  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    The sorting arrows more certainly should be visible when using server-side processing, as can be seen in this demo: http://datatables.net/release-datatables/examples/server_side/server_side.html .

    I would suggest having a look at the Firebug / Inspector console and seeing if you are getting any 404 errors, or any other errors. Also would be worth looking at your server error log just to make sure.

    Failing that, I'm afraid I would need to see the page.

    Allan
  • kimsiakimsia Posts: 14Questions: 0Answers: 0
    Hi Allan,

    thank you. I have resolved it by disabling the original initTables function the themeforest theme was using.
This discussion has been closed.