WebDev

From www.wiki.chlamdb.ch
Revision as of 18:54, 28 February 2019 by Tpillone (talk | contribs) (Created page with "<br /> == DataTable == === WordWrap specific column of the table === * first add a class to the target column <syntaxhighlight lang="javascript+myghty"> $('#example').dataT...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


DataTable

WordWrap specific column of the table

  • first add a class to the target column
$('#example').dataTable( {
  "columnDefs": [
    { className: "wrapcol", "targets": [ 1 ] }
  ]
} );
  • Then add css to customize column
table td.wrapcol {
  word-break: break-all;
  word-wrap: break-word;
  width: auto;
}

Divers

Dessin download

<i class="fa fa-download">

CSS

Hide elements

#ref{
display: none;
}

Javascript


Link directly to specific boostrap tab


// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
    $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
} 

// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function (e) {
    window.location.hash = e.target.hash;
})