Serverside Ordering vs Simple Datatable

Serverside Ordering vs Simple Datatable

sasuandreisasuandrei Posts: 5Questions: 1Answers: 0

Hello,

As I read forum topics and datatables manual I understand that ordering / sorting on table (default or on each column) is not working on serverside table.
I used a serverside table because I've wanted to create a dynamic table (When a client clicks on a button and the value changes, the table is redraw and the new values is shown without refreshing the all page - PHP and Laravel). Even for the filter data / column I've user laravel datables yajra because the default filter datable isn't working on serverside.

So, can you help me with a solution to use the default sorting or column sorting with serverside?
Or did I miss something and dynamic table can be created with the simple datatable function?
Thank you

Replies

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421

    Hmmm, I have a couple of questions:
    - Who told you that ordering is not working with serverside? I can reassure you that it is working! I do it every day. Since ordering is done on the server it might not work in cases of client side rendering if that materially changes the content of a column. But that's all.
    - What is "the all page"?
    - What is "the simple datatable function"?

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Datatables can access the server data using the ajax option. You can send search parameters to the server using ajax.data as a function, like this example. Note the example has server side processing (serverSide: true) enabled. You don't need to enable server side processing for the ajax.data function to work. Use ajax.reload() to fetch a new set of data.

    Set the ordering option to false to disable Datatables ordering. The table will be displayed in the order the data is received from the server's JSON response.

    Kevin

  • sasuandreisasuandrei Posts: 5Questions: 1Answers: 0

    For @rf1234
    1. Is working but not that that simple as in datatables function on a table generated by a foreach in php file
    2. For a dynamic table I understand that a table is updated and reloaded automatically without reloading the web page. Just a ajax trigger to update a value and reload the table (values in table)
    3. A simple datatable function when you generate the table in php page with a foreach or a for who is building the table. The ordering, filtering is much easier. A complex datatable function with serverside - is an extra work for getting the data, ordering the data, filtering the data etc.
    I am glad that your ordering is working. I couldn't make it. For now. That's why I needed a solution or an example.

    Thank you @kthorngren I will read more about this.
    For example now I am reading and trying to test this: https://yajrabox.com/docs/laravel-datatables/master/manual-order

  • rf1234rf1234 Posts: 3,000Questions: 87Answers: 421

    If you used Editor your life would be a lot easier. Good luck!

  • sasuandreisasuandrei Posts: 5Questions: 1Answers: 0

    What is Editor?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Editor is the extension to DataTables that offers CRUD capabilities. i.e. allows tables to be easily edited!

    Colin

Sign In or Register to comment.