Disable column sorting/ordering until data is in a table.

Disable column sorting/ordering until data is in a table.

dhilbmanndhilbmann Posts: 5Questions: 2Answers: 1

Hey everyone.

I have a datatable that is using server-side processing and defered rendering. On my page, above the table, I had some inputs for filtering first name, last name and an organization name. There is also a search button on the page. When the page is first loaded I display no data, forcing the user to click the search button. I do an ajax call whenever the search button is clicked by calling oTable.api().ajax.reload(). Datatables will call the ajax when the pagination or column headers are clicked. Both of those cases will return data (or not if there's nothing to return).

Unfortunately, I received an issue where a user clicked a column header on an empty table and that automatically made a call to the server. Because of this I was given a new requirement -- "Disable column sorting until the table has data." Is this even possible? I know column sorts are set during initialization and the only way I can imagine this is to reinit the table... but, I imagine that's going to have a slew of issues since my datatable is set up for serverside processing.

Has anyone tried this before?

Answers

This discussion has been closed.