Toggling settings

Toggling settings

whowerywhowery Posts: 4Questions: 1Answers: 0

Is it possible to update an option/setting after initialization? For example, I would like to have serverSide processing set to false initially, then toggle it on after performing the first search.

Answers

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin

    No - sorry. Many settings can be modified via the API, but that is not one of them.

    I don't really understand why you would want to load the full data set and then throw it away on the first search?

    Allan

  • whowerywhowery Posts: 4Questions: 1Answers: 0

    Maybe there is another way to do what I want to do. I'm trying to load the table initially with a AJAX call kicked off from a button click, to get the first page of data. Then I want Datatables to take over, and make subsequent AJAX calls when the user clicks the 'Next' page button, I'm trying to do server side paging.
    The problem I am running into now is that the table is making an initial AJAX call to the server when the table is initialized, I don't want it to make that initial call, I want it to wait for user interaction. I'm using DT 10.

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin

    I see, so it isn't DataTables that is making the first Ajax call and rendering the data? In which case use the deferLoading option. See also this example.

    Allan

  • whowerywhowery Posts: 4Questions: 1Answers: 0

    That's a lot closer to what I need, looks like deferLoading will work. Might be nice if there was a deferLoading:"ALL" setting, as opposed to having to specify how many rows to defer. Thanks Again!

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin

    The deferLoading option as an integer tells DataTables the information it needs to know for paging etc. Using ALL wouldn't provide that data.

    Allan

  • whowerywhowery Posts: 4Questions: 1Answers: 0

    Thanks Allan. I just figured out how easy it is to let Datatable make the initial AJAX request, so I don't need to mess with the deferLoading, I just let DT handle everything. Thanks again!

This discussion has been closed.