Raja
Raja

Reputation: 3627

Update datatable with new request and add / remove columns

I am trying with jquery datatable. Actually i am able to trigger new ajax request with an external button using the below code.

currentSource = "/an http url/";                            
var table = $('#datatableid').DataTable();
table.ajax.url(currentSource).load();

The new request was successful but i do not see any table data.

Have attached screenshot for the same. Datatable issue

In the screenshot you can see the entries count too and even the count get changes when i try some searches in the search box. But i do not see the content. :(

And i would like to remove some column once request the request was completed. This is my second problem too.

Any help would be appreciated.

Upvotes: 2

Views: 988

Answers (1)

Raja
Raja

Reputation: 3627

It was purely my fault as a beginner in Datatable.

I put the below code mistakenly which i could not notice and It is also executed when i try to reload with new ajax request externally.

table.columns(dtableCols).visible(false)

Where dtableCols is an array of all column ids. eg: [0,1,2,3,4,5]

This caused me datatable values makes hidden and now i have removed. It is working fine. Thanks for all your suggestions.

Upvotes: 1

Related Questions