How to use dropdown filters on server-side?

How to use dropdown filters on server-side?

rihno99rihno99 Posts: 1Questions: 1Answers: 0
edited March 2017 in Free community support

Is any simple solution to use dropdown filters on server-side processing?
The problem is that the data for the current display is available at the client-side (if column().data() is used).

I understand that I need to get the full list of options from the server in order to populate the select options by adding those options to my JSON data for the initial data load (draw=1) and use that information in initComplete to create the select lists. But i don't know how to do this.
Please help.

Thanks

Answers

  • DevBizDevBiz Posts: 6Questions: 0Answers: 0

    Need Help for the same ques. Can any one help me for the same pls

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    it depends on what you are trying to accomplish.
    Assuming that you have a simple paging solution with the search box turned on, everything you need will be passed to the server for you. On the server, you will use that object to create your response object.

    http://live.datatables.net/zewiqiyo/2/edit shows a sample that as simple as it gets.

    Press F12 to open your console. then hit the run button. The console.log(filter) will show you exactly what is being sent to the server.

    That is also one place you can add additional parameters such as select box value or values from other controls that might be on the page.

    http://live.datatables.net/zewiqiyo/1/edit is an example of how you could pull the data out of a select box and add it to the data going to the server. (However, it does not fully work since I do not have control over the server)

  • DevBizDevBiz Posts: 6Questions: 0Answers: 0
    edited May 2017

    We have around 4-5K data into table, so currently we can't load full data on load. But we require to have all unique options avaiable into dropdown so that customers can filter data easily. Please refer below screen shots for more details.

    Data loaded on first load : https://drive.google.com/file/d/0Bz8GI5_TTsiwTXhkNXoyR0ZjRzQ/view
    Second page : https://drive.google.com/file/d/0Bz8GI5_TTsiwTXhkNXoyR0ZjRzQ/view

    There isn't any options added to any of the dropdowns for the data coming from page two. I need solution where I can have all unique data from database column to be loaded into dropdown when page gets loaded first time with out loading all data together. As we are having 5K products in queur to be added to table.

    I have also tried to solve the problem with drawCallback() function but not working as expected.

    It urgent for me to get solution for the problem I am facing right now. There is n't any google help available for the same.

  • DevBizDevBiz Posts: 6Questions: 0Answers: 0

    If you want I can share my development server url for test cases.

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    I have some ideas and have started a solution though it may not be until tonight before I put it out here.

    To make sure we are on the same page, the select boxes only filter what is on the page (meaning they do not generate a server trip).

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    I am still working on this but in doing so, I came across this...
    https://github.com/vedmack/yadcf

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    I played with that plugin. It makes it easy. If it does not meet your needs let me know.

  • DevBizDevBiz Posts: 6Questions: 0Answers: 0

    Yes!! that is exactly what we need but not getting how do we apply it on our data table with having server side scripting.

  • pratsprats Posts: 45Questions: 21Answers: 0

    definitely try https://github.com/vedmack/yadcf. It works good with server side data

  • ManuelWennerManuelWenner Posts: 16Questions: 2Answers: 1

    @DevBiz I came across the same problem. Could you fix it?

  • ManuelWennerManuelWenner Posts: 16Questions: 2Answers: 1

    @DevBiz I came across the same problem. Could you fix it?

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Linking to this thread, as a similar discussion and a proposed solution.

This discussion has been closed.