Quantcast
Channel: ColVis — DataTables forums
Viewing all 77 articles
Browse latest View live

Hide Columns on draw but have as options to show in ColVis

$
0
0

We are using Buttons 1.0.3 and ColVis with 1.10.10 datatables and would like to draw the table with columns hidden but available through the ColVis button. From the documentation I could not find any way to do this and I wondered if anyone know if/how this can be done?

eg hide column 3 on draw but show in the ColVis button list of available columns (inactive)

<table>
<tbody>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tbody>
</table>
<ul class="dt-button-collection dropdown-menu">
<li class="dt-button buttons-columnVisibility active" tabindex="0" aria-controls="project-list-table"><a>Column 1</a></li>
<li class="dt-button buttons-columnVisibility active" tabindex="0" aria-controls="project-list-table"><a>Column 2</a></li>
<li class="dt-button buttons-columnVisibility" tabindex="0" aria-controls="project-list-table"><a>Column 3</a></li>
</ul>

Thanks


Use jQuery selector with ColVis to exclude columns of certain classname

$
0
0

I want to prevent two of my table's hidden columns from being toggled as visible when using ColVis, but I'm finding the column selector article a bit confusing and can't figure out how to do this.

I've added a className of "nonUser" to the two columns I want to remain permanently hidden but I don't know how to get ColVis to work on all columns except for those two.

How to get column config of DataTable and feed it to DataTable dynamically ?

$
0
0

Before, in our old application we are using JQGrid free, as far as I am aware there are a lot's of feture in JQGrid that we can see some of them in DataTable,
before we are saving column state of jqgrid per users in DB and read back it while users get log-in,
now we migrate to DataTable but some feature are not easy to use ,
so my main issue is saving column state in DB and read it back to render, is there a way to get column config of DataTable and feed it to DataTable dynamically not static,ordering,visibility and so on...

How to make columns made visible by ColVis button searchable

$
0
0

The columns that are initially hidden in the table have the searchable set to false.

This is important otherwise rows appear in the search results because they have met search criteria in hidden columns but this is confusing to the user (especially if using searchHighlight.js - none of the data is highlighted).

So all hidden columns need to be non-searchable (initially).

If they make a column visible via the colvis, however, the column is not made searchable.

Is there a way to make a column searchable when it is made visible and then not searchable if it is hidden?

Not found page Why ?

$
0
0

Why not found page ?????????????? (colVis examples pages)?????????

Column groups toggle button?

Set default button groups hidden

Why ColVis will not show remaining fields in a responsive layout?


Colvis doesn't work in with "collectionLayout: 'fixed'" in Editor 1.7.x?

$
0
0

Hi folks,

I just upgraded to DT Editor 1.7.3 and I noticed that colvis doesn't work anymore for me. Here's my configuration for buttons:

{ extend: 'colvis',
  collectionLayout: 'fixed',
}

I figured out that it's because I don't include buttons in the DOM (dom: "frtip") and I trigger colvis via the .trigger() API. Does anymore have an easy solution to this problem? The only solution I've found is to include buttons in the DOM (dom: "Bfrtip") and then override the DTE css to hide them afterwards.

ColVis + fixedColumns

$
0
0

I would like to use both extensions together with a very simple challenge: just keep the leftmost column, a very small one, in a fixed position. Now...the compatibility-chart seems to suggest there might be problems, whereas this page does not mention there are issues to be expected. So I don't know if I have hit a case of "told you so" or whether it is a bug:

Unfortunately there is a problem with the intialisation of the table which seems to be all messed up. If I enable additional columns after init, the table gets redrawn and is formatted correctly (forevermore, I think).

Repro here.

Issue with ColVis + colReorder + hidden column

$
0
0

Hi !
I think I identified a bug that has to do with colvis combined with the colReorder option.

Please run this jsfiddle: https://jsfiddle.net/KarloX2/b9zcwueg/

Run and do this:
* Notice that the column "B" is initially hidden (visible: false)
* Drag&Drop the header of column "A" to the right of column "C", so the table now shows the column order "C" + "A" + "D"
* Click the "Column visibility" button so it opens the the dropdown. (Notice that the order of the buttons has become adjusted just fine.)
* Here's the bug: Click the button "C" to hide that column and observe that this made column "B" become visible instead !!
* Other buttons in the "Column visibility" dropdown will cause a wrong action as well.

Any idea how I could try to fix this?

Thanks!

Customize ColVis menu layout (Bootstrap 4).

$
0
0

I have reviewed the ColVis button docs here https://datatables.net/reference/button/colvis

Outside of columnText, and columns I don't see an easy way to truly customize the menu.

Some examples of things id like to do:

  • Sort the column text in the menu differently than the column order on the table
  • Group some column buttons next to each other

I have 50+ columns on there so users are having to scroll to get to the bottom of the dropdown.

I tried to search the forums for an answer but you can image how muddied the results get with keywords like "ColVis Columns Button Extensions Sort Order Customize Dropdown"

Reseting Colvis

$
0
0

Hi guys,

have a problem with reseting colreOrder and ColVis extensions. Not sure if I am just calling wrong function or it is a bug.
jsFiddle provided: https://jsfiddle.net/g5towL6c/3/

if you reorder columns and than you hit the reset button, columns are back in default order, but when you hit ColVis button, column buttons are still reordered and if you try to hide column by clicking its button it hides different column instead.

Thanks

Redraw for colvisgroup only once

$
0
0

My table has a large number of columns. By default, I only display a small subset.

Using the button extension colvis, I am giving the user three options to change column visibility. Two colvisGroup buttons and one colvis button that allows control over the visibility of each column individually.

{
  extend: 'colvisGroup',
  text: 'Summary Columns',
  show: [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ],
  hide: [ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45],
},
{
  extend: 'colvisGroup',
  text: 'Detail Columns',
  show: [ 3, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44],
  hide: [ 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 45 ],
},
{
 extend: 'colvis',
 collectionLayout: 'fixed two-column',
 columns: ':not(.noVis)',
 postfixButtons: [ 'colvisRestore' ],
}

My table also highlights some cells' values if certain conditions are met via a rowCallBack. Whenever a user changes column visibility, I have to draw the table to ensure that the correct cell values are highlighted. Therefore I added an event handler for column-visibility.dt, but unfortunately for the colvisGroup it fires for each of the columns to be shown slowing down the display of the table.

$('#hrifcpq').on( 'column-visibility.dt', function ( e, settings, column, state ) {
    tablehrif.draw();
} );

I am looking for a modification to my event handler that would function more like this:

$('#hrifcpq').on( 'column-visibility.dt', function ( e, settings, column, state ) {
    if (user clicked on colvis button) tablehrif.draw();
    else if (user clicked on colvisGroup button) {if (column == hriftable[0].length-1-3) {tablehrif.draw();}}
} );

Is this possible?
Is there another way to trigger the rowCallBack besides listening to the column-visibility.dt event?

Please let me know if you have a suggestion, thank you!

columnText renders text, not html, when using colReorder and colVis and bootstrap

$
0
0

Demo: https://jsfiddle.net/friek2k/fjwjfuxL/

In this demo, on first load, columnText appropriately renders the supplied html as html. However, if you try re-ordering the columns, then opening the columns dropdown again, the buttons are echoed as text - i.e. the html isn't rendered.

Any suggestions on how to remediate?

Thanks a lot


Misaligned dropdown menu for ColVis after upgrading to 1.10.21

$
0
0

After upgrading DataTables from version 1.10.15 with static files to CDN version 1.10.21, generation of dropdown menu for colVis changed which led to wrong placing of dropdown list. List is position on left border of datatable.

This is how it looks:

This is old version HTML:

And this is new version HTML:

dt-button-collection class is in separate <div> now and position calculation is wrong.I managed to track the issue down to buttons.js file, issue is somewhere in latest version.

this is generated CDN from download page:
https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-html5-1.6.2/b-print-1.6.2/cr-1.5.2/fc-3.3.1/fh-3.1.7/kt-2.5.2/r-2.2.5/sc-2.0.2/sp-1.1.0/sl-1.3.1/datatables.min.js

When I change b-1.6.2 to b-1.6.1 everything works fine.
I won't fiddle with it any more since it's working, just wanted to let you know, and hopefully help anyone if they have similar issue.

tooltip on columns hidded

$
0
0

Hello, I have a datable with long texts (for cells and headers). So I use the tooltip to display only the first characters of it. When the mouse is on the text, it displays the full text.
I use the colvis option too. I don't want to display all columns at the begin.

When I display a column not visible by default, the tooltip function doesn't work. Only the first caracters are displayed and nothing appears with the mouse. How can i solve that ?

When i hide a column already there by default, and re-display it, the tooltip works. So that means the php code which generates the tooltip are not execute on columns not displayed by default...

Any help is welcomed :) I'm currently trying to do a live example

How to revert the hide logic

$
0
0

I need to revert the hide logic.
The default logic is: user clicks on the columns that he doesn't want to show.
What I need: everything loads hidden than user select columns that he wants to show.

My code:

{
extend: "excelHtml5",
text: '<i class="fluigicon fluigicon-file-xls icon-sm">Obra</i> ',
titleAttr: "Exportar para Excel",
className: "btn btn-success",
exportOptions: {
columns: [
300,
301,
302,
303,
304,
305,
306,
307,
308,
309,
310,
311,
312,
313,
314,
],
},
},

ColVis with Show Entries Option

$
0
0

Hi

I am wondering if we can have both ColVis (ref: ColVis.png) and Show Entries (ref: ShowEntries.png) functionalities available altogether for a single dataTable. I tried to find an example regarding the same but didn't find any.

Please help me out in achieving this.
Thanks in advance.

Dynamically setting the order for colvis

$
0
0

Can someone help me in setting the order for this filter? thanks

Viewing all 77 articles
Browse latest View live