How to reduce the number of default columns in datatables.
How to reduce the number of default columns in datatables.
Please I will like to know how I can reduce/increase the number of columns in the default datatable example. Here's an example: http://live.datatables.net/salodilo/1/edit
Let's say I just want to create a table that has just four columns: Name, Position, Office and Age., how do I go about this? I'm sincerely sorry if this question has been answered before, but I didn't find it. If there's a link to the answer to this question, please paste it here, and I'll give it a go.
I'm very very new to javascript and datatables, please.
Answers
So within the HTML of your example you will see the following:
now the <th> tag represents the tables header and there is one for each column. Adding more <th> tags (or removing some) will change the amount of columns you have. Bear in mind that each row (<tr>) has the same amount of table data entry (<td>) tags representing each field within the table. Just follow the same order as your column headers to match up the data with the appropriate column.