Problem to adding a Custom Column
Problem to adding a Custom Column
Hi,
really great tool you did. i just tried to add a new column.
it should be for a edit button.
i put in the server_side.html a new column.
then the alert come: added data does not match with the number of columns.
i try to add a echo with my data in the server_processing.php
under:
* If you need to add any extra columns (add/edit/delete etc) to the table,.....
but nothing happen and the script didnt work anymore.. just Processing...
would be nice to get a tip how i must echo my own content/data.
regards
moon
really great tool you did. i just tried to add a new column.
it should be for a edit button.
i put in the server_side.html a new column.
then the alert come: added data does not match with the number of columns.
i try to add a echo with my data in the server_processing.php
under:
* If you need to add any extra columns (add/edit/delete etc) to the table,.....
but nothing happen and the script didnt work anymore.. just Processing...
would be nice to get a tip how i must echo my own content/data.
regards
moon
This discussion has been closed.
Replies
Allan
I am stuck in the same situation and it would be very nice if you could give me a tip.
I also want to add a empty column and fill it with other content.
So far as I understood I need only to edit the server_processing.php and add the column in the space you provided which is marked:
/*
* Optional Configuration:
* If you need to add any extra columns (add/edit/delete etc) to the table, that aren't in the
* database - you can do it here
*/
Can you please give me an example how this code line should look like?
Thank you in advance & regards
mtombers
it looks like you have the same problem like me to put out content in a column what is not from the DB.
@allan: can you give us a tip/example how the output should be ?
regards
moon
I used fnRender function to add an edit column. Not sure if this is the best way to do it but here you go...
[code]
oTable = $('#tblSchedule').dataTable({
"bPaginate": false,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"aoColumns": [null, null, null,
null, null, { "bSortable": false,
"fnRender": function(oObj) {
return 'Edit'
}
}]
});
[/code]
[code]
$sOutput .= '"column value",';
[/code]
in that section will add another column to the returned json.
Allan
thanx a lot. that works perfect !
regards
moon
My html rendering has 5 columns...
Name
Username
Email
Status
Actions
The lasy column actions I simply want to add in edit and delete links for each row item.
Now in my data file I have the following...
$aColumns = array( 'firstname', 'username', 'email', 'status', 'city');
City for now Im just pulling in data from the database which all works BUT I want that last column to be the 'actions' column that doesnt come from the database.
I see you have this written...
/* * Optional Configuration: * If you need to add any extra columns (add/edit/delete etc) to the table, that aren't in the * database - you can do it here */
$sOutput = substr_replace( $sOutput, "", -1 );
$sOutput .= "],";
but I still have no clue what I need to do here. Anyone with an exact example they used. I can get the data workign fine if I have no custom columns, its when I need to add a custom column (last column basically)
Thanks again
Allan
Thanks
Allan
Thanks for the quick response. This is what I'm trying to achieve.
============================================================
Name Address Phone
Title Email Fax
============================================================
John Smith 123 Test drive, Test, CA 000-000-0000
President test@test.com 111-111-1111
____________________________________________________________
Both Name and Title are sortable.
Thanks
I'm afraid that this is not something which is really supported in DataTables at this time. At the moment each row is treated entirely independently (it is possible to link them together using aaSortingFixed and a hidden column actually - so sort of possible!). In a future version I hope to add support for multiple tbody elements to deal with this kind of situation.
Allan
Can you give me an example of how it can be done using aaSortingFixed and hidden column?
Thanks