-
Notifications
You must be signed in to change notification settings - Fork 242
Invisible column property not working #57
Comments
Same problem for me, for the same goal. Having the id in the table but not visible. option array('visible' => false) does not work 👍 |
I can not find any issue. Is this a problem with CSS? |
I just don't know... My scenario :
->add('id', 'column', array('visible' => false))
var columns = {
"columns": [
{
"searchable": true,
"orderable": true,
"visible": false,
"title": "",
"className": "",
"defaultContent": "",
"width": "",
"contentPadding": "",
"name": "",
"data": "id",
}, Then, I don't know how datatable.js should hide this column... probably with CSS. Anyway, in the element inspector, I can't see any specific CSS class on this column and its cells so that they are hidden :-( |
please try only:
|
Does not work... I removed my assets installed with bower, I install the recommended bundle with composer {% stylesheets '%kernel.root_dir%/../vendor/datatables/datatables/media/css/jquery.dataTables.css' output="css/jquery.dataTables.css" %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
../..
{% javascripts '%kernel.root_dir%/../vendor/datatables/datatables/media/js/jquery.dataTables.js' output="js/jquery.dataTables.js" %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %} Then, when I add this on my datatable, the new column still appears : ->add('id', 'column', array('visible' => false)) |
cache cleared?
|
Yes sir ! Can you explain me how datatable should hide a column with visible: false ? It puts a css class on column or somewhere ? or it does just create the dom for this column ? |
see the answer: https://datatables.net/forums/discussion/25416/how-datatable-should-hide-a-column-with-visible-false The one common 'gotcha' is using Responsive with column visibility, since Responsive controls the column visibility. You can add the class never to a column if you never want it to be visible. |
It works after a change of "visible" everything properly. You still have to delete the browser's cache. |
Thanks a lot Steffen. But I can't understand what means "a change of "visible" everything properly" |
I change from "visible=>false" to "visible=>true".....or "visible=>true" to "visible=>false". |
Ok, I will try this tomorrow and tell you. |
Thanks @stwe, looks like the gotcha mentioned by allan with Responsive datatables extension is the reason for my case, as I'm using it. The Responsive documentation for the class @hmillet are you using this extension too? |
@fdelapena , i can add:
|
Thanks, looks good to me to have it in, as the Responsive extension looks popular and doesn't bloat much the code result when unused. |
@stwe : Now that I understand that "cache cleared" means "browser cache", that's work fine for me, sorry for this misunderstanding... @fdelapena : Hi ! I don't use the Responsive datatables extension, but... it seems great, I probably do it soon ;-) |
According with documentation examples, this column shouldn't be rendered with this option:
In order to pass some column name to
route_parameters
these column names are needed to be provided to the column builder but sometimes are not desired to be rendered (e.g. remote column IDs), so fixing this feature without hiding it withclass
hacks is a nice one to have.Also, doing display:none to th and td instead of skipping rendering "conflicts" with datatables-responsive extension, showing a "plus" to show this hidden column, which it is not desired too.
The text was updated successfully, but these errors were encountered: