HTML Columns
HTML Columns
Manny89
Posts: 5Questions: 0Answers: 0
I've managed to get DataTables to do exactly what I want it to do with regards to loading data from a MySQL database using PHP. This works perfectly fine, but I need to add an extra column to the end of my table which is written in PHP.
My table is being populated with data from my JSON file, but I get the following message because the end column is empty:
[code]DataTables warning (table id = 'datatables'): Requested unknown parameter '5' from the data source for row 0[/code]
My question here is, can I add the content of the extra column manually by editing my PHP file?
My table is being populated with data from my JSON file, but I get the following message because the end column is empty:
[code]DataTables warning (table id = 'datatables'): Requested unknown parameter '5' from the data source for row 0[/code]
My question here is, can I add the content of the extra column manually by editing my PHP file?
This discussion has been closed.
Replies
Allan
I have created a table with five columns, but I only want to pull information from a JSON file for the first four of these. In the fifth (end) column, I want to code something in PHP or HTML that will fill the content of that empty column. For example, they could be links to an edit page that are dynamically created in PHP.
Here is my code.
[code]
ID
Date
Title
Keywords
Actions
[/code]
The five columns have been defined in the thead and the content is loaded through sAjaxSource, which is referencing a JSON file containing four fields per child element. These then fill the first four columns of each row inside tbody.
My question is how can I add content for the empty fifth column through HTML or PHP and not the JSON file.
One way, and there are probably others, is to add the data that you want manually into the last column of the output data array when you are creating the data in the php file - something along the lines of
[code] $data[4] = 'my data';[/code]
1. Do as david63 suggests and add the extra information to the data feed for the table
2. Use sDefaultContent and set it to an empty string.
If you want links to an empty page then using mRender would probably be appropriate - use that to create the appropriate link.
Allan