{"id":2841,"date":"2019-04-29T13:47:13","date_gmt":"2019-04-29T11:47:13","guid":{"rendered":"http:\/\/slamsoft-corp.com\/?p=2841"},"modified":"2019-04-29T13:54:34","modified_gmt":"2019-04-29T11:54:34","slug":"fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery","status":"publish","type":"post","link":"https:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/","title":{"rendered":"Fixer la premi\u00e8re ligne d&rsquo;un tableau de donn\u00e9es sur une page web avec Jquery"},"content":{"rendered":"\n<p>Lorsque l&rsquo;on doit g\u00e9rer les tables d&rsquo;une base de donn\u00e9es relativement importante et qu&rsquo;on les consulte via un navigateur dans une page en <strong>PHP<\/strong>, il est plus agr\u00e9able de conserver l&rsquo;intitul\u00e9 de chaque colonne toujours visible sur la premi\u00e8re ligne. <br>Sans cela, l&rsquo;utilisateur se retrouve avec un \u00e9cran rempli d&rsquo;informations parfois difficiles \u00e0 identifier.<\/p>\n\n\n\n<p>Pour cela, il faut donc fixer la premi\u00e8re ligne de mani\u00e8re \u00e0 ce qu&rsquo;elle reste toujours \u00e0 l&rsquo;\u00e9cran, tout en permettant au reste du tableau d&rsquo;\u00eatre scroll\u00e9 pour pouvoir consulter la Data.<\/p>\n\n\n\n<p> Si la t\u00e2che est tr\u00e8s simple pour les balises &lt;DIV> avec un \u00ab\u00a0<em>position: fixed;<\/em>\u00a0\u00bb dans le CSS, elle ne l&rsquo;est pas autant avec les cellules d&rsquo;un tableau&#8230; <\/p>\n\n\n\n<p>Mais \u00e7a devrait aller quand m\u00eame \ud83d\ude09<br><br><\/p>\n\n\n\n<h3>Une solution simple avec Jquery<\/h3>\n\n\n\n<p> La  <a href=\"http:\/\/slamsoft-corp.com\/index.php\/tube-daccueil\/\">SlamsOft Corporation<\/a> vous propose une solution <strong>Jquery<\/strong> afin d&#8217;emp\u00eacher le scroll de la premi\u00e8re ligne de votre tableau, et ainsi rendre plus ergonomique, la lecture de vos donn\u00e9es.<\/p>\n\n\n\n<p>Pour commencer vous allez devoir appeler les Scripts suivants en pla\u00e7ant le code ci-dessous dans votre &lt;head> :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script type=\"text\/javascript\" src=\"\ufeffhttps:\/\/code.jquery.com\/jquery-3.4.0.min.js\">&lt;\/script>\n&lt;script type=\"text\/javascript\" src=\"https:\/\/unpkg.com\/sticky-table-headers@0.1.24\/js\/jquery.stickytableheaders.min.js\">&lt;\/script>\n\n&lt;script type=\"text\/javascript\">\n$(function() {\n  $(\"table\").stickyTableHeaders();\n});\n&lt;\/script><\/code><\/pre>\n\n\n\n<p><br>Si vous pr\u00e9f\u00e9rez \u00e9viter d&rsquo;appeler un Script via une URL, vous pouvez aussi copier le code sur les liens suivants et cr\u00e9er vos pages de JS : <\/p>\n\n\n\n<p><a href=\"https:\/\/code.jquery.com\/jquery-3.4.0.min.js\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/code.jquery.com\/jquery-3.4.0.min.js<\/a><br> <a rel=\"noreferrer noopener\" href=\"https:\/\/unpkg.com\/sticky-table-headers@0.1.24\/js\/jquery.stickytableheaders.min.js\" target=\"_blank\">https:\/\/unpkg.com\/sticky-table-headers@0.1.24\/js\/jquery.stickytableheaders.min.js<\/a> <br>En faisant ainsi, n&rsquo;oubliez pas de rediriger la source de votre code vers le bon fichier JS.<br> <\/p>\n\n\n\n<p>Rentrez ensuite le code <strong>html <\/strong>de votre tableau :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;table>\n  &lt;thead>\n    &lt;tr>\n      &lt;th>Ligne1-colonne1&lt;\/th>\n      &lt;th>Ligne1-colonne2&lt;\/th>\n      &lt;th>Ligne1-colonne3&lt;\/th>\n    &lt;\/tr>\n  &lt;\/thead>\n  &lt;tbody>\n    &lt;tr>\n      &lt;td>Ligne2-colonne1&lt;\/td>\n      &lt;td>Ligne2-colonne2&lt;\/td>\n      &lt;td>Ligne2-colonne3&lt;\/td>\n    &lt;\/tr>\n    &lt;tr>\n      &lt;td>Ligne3-colonne1&lt;\/td>\n      &lt;td>Ligne3-colonne2&lt;\/td>\n      &lt;td>Ligne3-colonne3&lt;\/td>\n    &lt;\/tr>\n  &lt;\/tbody>\n&lt;\/table><\/code><\/pre>\n\n\n\n<p>Une fois que vous aurez fait tout cela, vous obtiendrez le r\u00e9sultat esp\u00e9r\u00e9.<br><\/p>\n\n\n\n<p> La  <a href=\"http:\/\/slamsoft-corp.com\/index.php\/tube-daccueil\/\">SlamsOft Corporation<\/a> vous remercie de votre visite dans ce <strong>Tube <\/strong>et vous souhaite une bonne journ\u00e9e.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lorsque l&rsquo;on doit g\u00e9rer les tables d&rsquo;une base de donn\u00e9es relativement importante [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2884,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[23,13],"tags":[52,56,55,53,54],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Fixer la premi\u00e8re ligne d&#039;un tableau de donn\u00e9es sur une page web avec Jquery - slamsOft Corp.<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fixer la premi\u00e8re ligne d&#039;un tableau de donn\u00e9es sur une page web avec Jquery - slamsOft Corp.\" \/>\n<meta property=\"og:description\" content=\"Lorsque l&rsquo;on doit g\u00e9rer les tables d&rsquo;une base de donn\u00e9es relativement importante [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"slamsOft Corp.\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/EggManu\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/EggManu\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-29T11:47:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-29T11:54:34+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/slamsoft-corp.com\/wp-content\/uploads\/2019\/04\/Egg-main-sur-la-tete-data-bandeau.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1921\" \/>\n\t<meta property=\"og:image:height\" content=\"767\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"SlamsOft\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@EggMarty\" \/>\n<meta name=\"twitter:site\" content=\"@EggMarty\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"SlamsOft\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/slamsoft-corp.com\/#website\",\"url\":\"https:\/\/slamsoft-corp.com\/\",\"name\":\"slamsOft Corp.\",\"description\":\"Tube craft\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/slamsoft-corp.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#primaryimage\",\"url\":\"https:\/\/slamsoft-corp.com\/wp-content\/uploads\/2019\/04\/Egg-main-sur-la-tete-data-bandeau.jpg\",\"contentUrl\":\"https:\/\/slamsoft-corp.com\/wp-content\/uploads\/2019\/04\/Egg-main-sur-la-tete-data-bandeau.jpg\",\"width\":1921,\"height\":767},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/\",\"url\":\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/\",\"name\":\"Fixer la premi\u00e8re ligne d'un tableau de donn\u00e9es sur une page web avec Jquery - slamsOft Corp.\",\"isPartOf\":{\"@id\":\"https:\/\/slamsoft-corp.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#primaryimage\"},\"datePublished\":\"2019-04-29T11:47:13+00:00\",\"dateModified\":\"2019-04-29T11:54:34+00:00\",\"author\":{\"@id\":\"https:\/\/slamsoft-corp.com\/#\/schema\/person\/230a6256c44062d2950c818ef8743acf\"},\"breadcrumb\":{\"@id\":\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/slamsoft-corp.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fixer la premi\u00e8re ligne d&rsquo;un tableau de donn\u00e9es sur une page web avec Jquery\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/slamsoft-corp.com\/#\/schema\/person\/230a6256c44062d2950c818ef8743acf\",\"name\":\"SlamsOft\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/slamsoft-corp.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/slamsoft-corp.com\/wp-content\/uploads\/2018\/04\/avatar_user_1_1523361156-96x96.jpg\",\"contentUrl\":\"http:\/\/slamsoft-corp.com\/wp-content\/uploads\/2018\/04\/avatar_user_1_1523361156-96x96.jpg\",\"caption\":\"SlamsOft\"},\"sameAs\":[\"http:\/\/slamsoft-corp.com\/\",\"https:\/\/www.facebook.com\/EggManu\/\",\"https:\/\/twitter.com\/EggMarty\"],\"url\":\"https:\/\/slamsoft-corp.com\/index.php\/author\/admin4504\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fixer la premi\u00e8re ligne d'un tableau de donn\u00e9es sur une page web avec Jquery - slamsOft Corp.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/","og_locale":"fr_FR","og_type":"article","og_title":"Fixer la premi\u00e8re ligne d'un tableau de donn\u00e9es sur une page web avec Jquery - slamsOft Corp.","og_description":"Lorsque l&rsquo;on doit g\u00e9rer les tables d&rsquo;une base de donn\u00e9es relativement importante [&hellip;]","og_url":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/","og_site_name":"slamsOft Corp.","article_publisher":"https:\/\/www.facebook.com\/EggManu\/","article_author":"https:\/\/www.facebook.com\/EggManu\/","article_published_time":"2019-04-29T11:47:13+00:00","article_modified_time":"2019-04-29T11:54:34+00:00","og_image":[{"width":1921,"height":767,"url":"http:\/\/slamsoft-corp.com\/wp-content\/uploads\/2019\/04\/Egg-main-sur-la-tete-data-bandeau.jpg","type":"image\/jpeg"}],"author":"SlamsOft","twitter_card":"summary_large_image","twitter_creator":"@EggMarty","twitter_site":"@EggMarty","twitter_misc":{"\u00c9crit par":"SlamsOft","Dur\u00e9e de lecture estim\u00e9e":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/slamsoft-corp.com\/#website","url":"https:\/\/slamsoft-corp.com\/","name":"slamsOft Corp.","description":"Tube craft","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/slamsoft-corp.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"fr-FR"},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#primaryimage","url":"https:\/\/slamsoft-corp.com\/wp-content\/uploads\/2019\/04\/Egg-main-sur-la-tete-data-bandeau.jpg","contentUrl":"https:\/\/slamsoft-corp.com\/wp-content\/uploads\/2019\/04\/Egg-main-sur-la-tete-data-bandeau.jpg","width":1921,"height":767},{"@type":"WebPage","@id":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/","url":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/","name":"Fixer la premi\u00e8re ligne d'un tableau de donn\u00e9es sur une page web avec Jquery - slamsOft Corp.","isPartOf":{"@id":"https:\/\/slamsoft-corp.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#primaryimage"},"datePublished":"2019-04-29T11:47:13+00:00","dateModified":"2019-04-29T11:54:34+00:00","author":{"@id":"https:\/\/slamsoft-corp.com\/#\/schema\/person\/230a6256c44062d2950c818ef8743acf"},"breadcrumb":{"@id":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/slamsoft-corp.com\/index.php\/2019\/04\/29\/fixer-la-premiere-ligne-dun-tableau-de-donnee-sur-une-page-web-avec-jquery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/slamsoft-corp.com\/"},{"@type":"ListItem","position":2,"name":"Fixer la premi\u00e8re ligne d&rsquo;un tableau de donn\u00e9es sur une page web avec Jquery"}]},{"@type":"Person","@id":"https:\/\/slamsoft-corp.com\/#\/schema\/person\/230a6256c44062d2950c818ef8743acf","name":"SlamsOft","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/slamsoft-corp.com\/#\/schema\/person\/image\/","url":"http:\/\/slamsoft-corp.com\/wp-content\/uploads\/2018\/04\/avatar_user_1_1523361156-96x96.jpg","contentUrl":"http:\/\/slamsoft-corp.com\/wp-content\/uploads\/2018\/04\/avatar_user_1_1523361156-96x96.jpg","caption":"SlamsOft"},"sameAs":["http:\/\/slamsoft-corp.com\/","https:\/\/www.facebook.com\/EggManu\/","https:\/\/twitter.com\/EggMarty"],"url":"https:\/\/slamsoft-corp.com\/index.php\/author\/admin4504\/"}]}},"_links":{"self":[{"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/posts\/2841"}],"collection":[{"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/comments?post=2841"}],"version-history":[{"count":49,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/posts\/2841\/revisions"}],"predecessor-version":[{"id":2892,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/posts\/2841\/revisions\/2892"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/media\/2884"}],"wp:attachment":[{"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/media?parent=2841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/categories?post=2841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/slamsoft-corp.com\/index.php\/wp-json\/wp\/v2\/tags?post=2841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}