IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

jQuery Discussion :

Découpe de tableau


Sujet :

jQuery

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti Avatar de manry
    Homme Profil pro
    Alternant administration système et sécurité
    Inscrit en
    Janvier 2014
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Alternant administration système et sécurité
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2014
    Messages : 64
    Par défaut Découpe de tableau
    Bonjour, je vous expose mon problème je dois avec du jquery faire une découpe de tableau par page (un certain nb de lignes par page etc) seulement j'arrive a créer mon nombre de page total mais je n'arrive pas à découper mes tableaux pour ensuite les insérer dans mes pages

    voila le jquery
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    $(document).ready(function(){
        var header = $('.header').wrap('<header/>');
        var numTables = $('table').length;
        var currentPage = 0;
        var currentRow = 0;
        var numPerPage = 10;
        var numRows = $('tr').length;
        var numPages = Math.ceil((numRows + numTables) / numPerPage);
     
        /*$('table').each(function() {
            var table = $(this);*/
     
            $('table').on('repaginate', function(){ // fonctionne pas mais devrais découper mes tableaux
                $(this).find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
            });
        // });
     
        for(var i = 0; i < numPages; i++){ // crée chaques headers
            $('<div class = "page"/>').html(header).clone().on('ready', { newPage: i }, function(event){
                currentPage = event.data['newPage'];
                $('table').trigger('repaginate').appendTo(this);
            }).prependTo('body');
        }
    });
    ainsi que le fichier html généré automatiquement depuis du xml xslt

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml"><head>
            <meta content="text/html; charset = utf-8" http-equiv="Content-Type">
            <link href="impression.css" media="all" rel="stylesheet" type="text/css">
    <script src = "jquery.js"></script>
    <script src = "impression.js"></script>
        </head>
        <body>
            <div xmlns="" class="header">
                <div class="societe">ɠAffid - ST 2012.1</div>
                <div class="praticien">Alain GENE</div>
                <div class="titre">JOURNAL DES RECETTES JOURNALIERES - EN EUROS</div>
                <div class="date">DU 12/06/2013 AU 22/11/2013                                                            </div>
            </div>
            <table xmlns="">
                <caption>Mercredi 12 Juin 2013</caption>
                <tbody><tr class="head">
                    <th class="champ">Nм/th>
                    <th class="champ">NOM PATIENT</th>
                    <th class="champ">ACTE</th>
                    <th class="valeur">MNT DU</th>
                    <th class="champ">NOM CLIENT</th>
                    <th class="champ">MODE</th>
                    <th class="valeur">CAISSE CA</th>
                    <th class="valeur">BQE 1</th>
                    <th class="valeur">BQE 1/2</th>
                    <th class="valeur">ATTENTE</th>
                    <th class="champ">RQUE TIERS PAYANT</th>
                </tr>
                <tr class="ligne">
                    <td class="champ">1</td>
                    <td class="champ">TEST ALAIN</td>
                    <td class="champ">C</td>
                    <td class="valeur">23.00</td>
                    <td class="champ">TEST ALAIN</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">25.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">2</td>
                    <td class="champ">TEST ALAIN</td>
                    <td class="champ">C</td>
                    <td class="valeur">23.00</td>
                    <td class="champ">TEST ALAIN</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">23.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">3</td>
                    <td class="champ">HOUSSAM</td>
                    <td class="champ">C</td>
                    <td class="valeur">23.00</td>
                    <td class="champ">HOUSSAM</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">23.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">4</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">5</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">6</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">7</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">8</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">9</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">10</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">11</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td></tr>
                <tr class="ligne">
                    <td class="champ">12</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">C</td>
                    <td class="valeur">245.00</td>
                    <td class="champ">THIERRY</td>
                    <td class="champ">B1CHQ</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">45.00</td>
                    <td class="valeur">0.00</td>
                    <td class="valeur">
                    </td><td class="champ">
                </td>
    </tbody></table>
     
    <br />
    </body></html>

    ps :mon fichier html est correct je n'ai pas copier tout le contenu donc c'est possible qu'il manque des balises dans le post

    PPS: merci vu que je ne savais pas comment ca fonctionnais pour le code et la coloration syntaxique j'ai mis ce que j'ai trouvé

  2. #2
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Billets dans le blog
    125
    Par défaut
    La génération est ratée ! La table n'est pas conforme, on doit avoir un vrai "thead".

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <table xmlns="">
                <caption>Mercredi 12 Juin 2013</caption>
                <thead>
                    <tr class="head">
                        <th class="champ">Nм/th>
                        <th class="champ">NOM PATIENT</th>
                        <th class="champ">ACTE</th>
                        <th class="valeur">MNT DU</th>
                        <th class="champ">NOM CLIENT</th>
                        <th class="champ">MODE</th>
                        <th class="valeur">CAISSE CA</th>
                        <th class="valeur">BQE 1</th>
                        <th class="valeur">BQE 1/2</th>
                        <th class="valeur">ATTENTE</th>
                        <th class="champ">RQUE TIERS PAYANT</th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="ligne">
                        <td class="champ">1</td>
                       <td class="champ">TEST ALAIN</td>
                       <td class="champ">C</td>

    Je ne comprends pas ce code : $('table').on('repaginate', function(){.

    Un événement "repaginate" ?
    Vous utilisez un plugin ?

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  3. #3
    Membre averti Avatar de manry
    Homme Profil pro
    Alternant administration système et sécurité
    Inscrit en
    Janvier 2014
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Alternant administration système et sécurité
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2014
    Messages : 64
    Par défaut
    Le thead est obligatoire??? je ne savais pas je corrige ça
    pour le 'repaginate' c'est un truc que j'ai lu qui s'appelle la délégation de tache et je l'ai appelé repaginate mais il ne s'agit en aucun cas d'un plugin, j'avais trouvé l'exemple ici seulement quand je test l'exemple en le bidouillant un peu je n'arrive pas à modifier pour que j'ai une partie de tableau en fonction de ma page et non pas clicker sur un bouton pour afficher la suite du tableau (c'est pour de l'impression)

    edit:j'en ait profiter pour ajouter aussi les tfoot

  4. #4
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Billets dans le blog
    125
    Par défaut
    J'ai repris et modifié (mise à niveau jQuery 2.1.0) le code de Gabriele Romanato.

    J'ai testé sur sa table de test et puis j'ai testé sur votre table générée, mais corrigée (il manquait aussi le tr final dans le tbody).

    Ci-dessous le code de ma page de test, pour voir le résultat il suffit de copier-coller.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    <!DOCTYPE html>
    <html lang="fr" dir="ltr">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1.0">
        <meta name="author" content="Daniel Hagnoul">
        <title>Forum jQuery</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.min.js"></script>
        <link rel="stylesheet" href='http://fonts.googleapis.com/css?family=Sofia|Ubuntu:400|Kreon'>
        <script>
            "use strict";
     
            var debugBool = true;
     
             /*
              * J'utilise head.js pour charger CSS et JS de manière asynchrone 
              * et parallèle, mais les fichiers sont exécute dans l'ordre.
              * Voir la documentation et l'API : http://headjs.com/
              * Les polices de caractères et le fichier head.js doivent être 
              * inclus manuellement.
              */
            head.load(
                "http://danielhagnoul.developpez.com/styles/dvjhRemBase.css",
                "http://code.jquery.com/ui/1.10.4/themes/sunny/jquery-ui.css",
                "http://code.jquery.com/qunit/qunit-1.13.0.css",
                { "d3" : "http://d3js.org/d3.v3.min.js" },
                { "d3Hello" : "http://danielhagnoul.developpez.com/lib/dvjh/d3Hello.js" },
                { "jquery" : "http://code.jquery.com/jquery-2.1.0.min.js" },
                { "jqueryui" : "http://code.jquery.com/ui/1.10.4/jquery-ui.min.js" },
                "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/i18n/jquery-ui-i18n.min.js",
                { "qunit" : "http://code.jquery.com/qunit/qunit-1.13.0.js" },
                { "testsQUnit" : "http://danielhagnoul.developpez.com/lib/dvjh/testsQUnit.js" }
            );      
        </script>
        <style>
            /* Nota bene : ici 1 rem est égal à 10 px, voir dvjhRemBase.css */
     
    /*-- Début code du test --*/
     
    table {
        display: none;
        margin: 2rem auto;
        border: none;
    }
    thead {
        background: #000;
        color: #fff;
    }
    th, td {
        min-width: 1.5rem;
        padding: 0.6rem;
    }
    tbody {
        background: #ccc;
    }
    div.pager {
        text-align: center;
        margin: 1rem 0;
    }
    div.pager span {
        display: inline-block;
        width: 1.8rem;
        height: 1.8rem;
        line-height: 1.8rem;
        text-align: center;
        cursor: pointer;
        background: #000;
        color: #fff;
        margin-right: 0.5rem;
    }
    div.pager span.active {
        background: #c00;
    }
     
    /*-- Fin code du test --*/
     
        </style>
    </head>
    <body>
        <header>
            <h1>Forum jQuery</h1>
            <h2>
                <a href="">Lien</a>
            </h2>
        </header>
        <section class="conteneur">
            <nav>
     
    <!-- Début code du test -->
     
     
    <!-- Fin code du test -->
     
            </nav>
            <article>
     
    <!-- Début code du test -->
     
    <table  class="paginated">
        <caption>Mercredi 12 Juin 2013</caption>
        <thead>
            <tr class="head">
                <th class="champ">N°</th>
                <th class="champ">NOM PATIENT</th>
                <th class="champ">ACTE</th>
                <th class="valeur">MNT DU</th>
                <th class="champ">NOM CLIENT</th>
                <th class="champ">MODE</th>
                <th class="valeur">CAISSE CA</th>
                <th class="valeur">BQE 1</th>
                <th class="valeur">BQE 1/2</th>
                <th class="valeur">ATTENTE</th>
                <th class="champ">RQUE TIERS PAYANT</th>
            </tr>
        </thead>
        <tbody>
            <tr class="ligne">
                <td class="champ">1</td>
                <td class="champ">TEST ALAIN</td>
                <td class="champ">C</td>
                <td class="valeur">23.00</td>
                <td class="champ">TEST ALAIN</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">25.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">2</td>
                <td class="champ">TEST ALAIN</td>
                <td class="champ">C</td>
                <td class="valeur">23.00</td>
                <td class="champ">TEST ALAIN</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">23.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">3</td>
                <td class="champ">HOUSSAM</td>
                <td class="champ">C</td>
                <td class="valeur">23.00</td>
                <td class="champ">HOUSSAM</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">23.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">4</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">5</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">6</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">7</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">8</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">9</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">10</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">11</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
            </tr>
            <tr class="ligne">
                <td class="champ">12</td>
                <td class="champ">THIERRY</td>
                <td class="champ">C</td>
                <td class="valeur">245.00</td>
                <td class="champ">THIERRY</td>
                <td class="champ">B1CHQ</td>
                <td class="valeur">0.00</td>
                <td class="valeur">45.00</td>
                <td class="valeur">0.00</td>
                <td class="valeur"></td>
                <td class="champ"></td>
             </tr>
        </tbody>
    </table>
     
    <!-- Fin code du test -->
     
            </article>
            <article class="qunit">
                <div id="qunit"></div>
                <div id="qunit-fixture"></div>
            </article>
        </section>
        <footer class="h-entry">
            <time class="dt-published" datetime="2014-01-22T10:36:43.443+0100">2014-01-22T10:36:43.443+0100</time>
            <a class="p-author h-card" href="http://www.developpez.net/forums/u285162/danielhagnoul/">Daniel Hagnoul</a>
            <a class="u-url" href="http://danielhagnoul.developpez.com/">Mon cahier d’exercices</a>
            <a class="u-url" href="http://javascript.developpez.com/faq/jquery/">FAQ</a>
            <a class="u-url" href="http://javascript.developpez.com/cours/?page=frameworks#jquery">Tutoriels</a>
        </footer>
        <script>
            "use strict";
     
            /*
             * Chargeur de code head.js, document ready et fichiers chargés.
             */
            head.ready( [ 
                    "d3", "d3Hello", 
                    "jquery", "jqueryui", 
                    "qunit", "testsQUnit"
                ], function(){
     
    /* Début code du test */
     
    $( "table.paginated" ).each( function( i, item ){
        var currentPage = 0,
            numPerPage = 10,
            jObjTable = $( item );
     
        jObjTable.on( "repaginate.customEvent", function(){
     
            jObjTable
                .find( "tbody tr" )
                .hide()
                .slice( currentPage * numPerPage, ( currentPage + 1 ) * numPerPage )
                .show();
        });
     
        jObjTable.trigger( "repaginate.customEvent" );
     
        var numRows = jObjTable.find( "tbody tr" ).length,
            numPages = Math.ceil( numRows / numPerPage ),
            jObjPager = $( "<div/>", {
                "class" : "pager"
            });
     
        for ( var page = 0; page < numPages; page++ ){
            $( "<span/>", {
                "class" : "page-number clickable",
                "text" : page + 1,
                "data-page" : page,
                "click" : function( event ){
                    currentPage = $( this ).data( "page" );
     
                    jObjTable.trigger( "repaginate.customEvent" );
     
                    $( this )
                        .addClass( "active" )
                        .siblings()
                        .removeClass( "active" );
                }
            }).appendTo( jObjPager );
        }
     
        jObjPager
            .insertBefore( jObjTable )
            .find( "span.page-number:first" )
            .addClass( "active" );
     
        jObjTable.show();
    });
     
     
    /* Fin code du test */
     
                if ( debugBool ){
                    console.log( ISOformat( new Date() ) );
     
                    $( ".qunit" ).show();
     
                    testQUnitSelector( "App", [ 
                        ".conteneur"
                    ] );
     
                    testQUnitID( "App", [ 
                        "qunit", "qunit-fixture"
                    ] );
                }
     
            });
        </script>
    </body>
    </html>

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  5. #5
    Membre averti Avatar de manry
    Homme Profil pro
    Alternant administration système et sécurité
    Inscrit en
    Janvier 2014
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Alternant administration système et sécurité
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2014
    Messages : 64
    Par défaut
    C'est bien le résultat recherché mais comme il s'agit d'un module d'impression il faudrait que chaque tableaux apparaissent dans une page séparée et non pas en fonction d'un click (le click va être compliqué sur papier ^^)

    edit: j'ai fais quelque chose comme ca

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    $(document).ready(function(){
    	var header = $('.header').wrap('<header/>');
    	var tableAffichage = [];
    	var numTables = $('table').length;
    	var currentPage = 0;
    	var currentRow = 0;
    	var numPerPage = 10;
    	var numRows = $('tr').length;
    	var numPages = Math.ceil((numRows + numTables) / numPerPage);
     
    	$('table').each(function() {
    		var table = $(this);
     
    		$(table).on('repaginate', function() { /* decoupage correct du tableau */
    			$(table).find('tbody').find('tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
    			$(table).css('border-bottom', '1px solid #027cff');
    		});
     
    		$.merge(tableAffichage, table);
    	});
     
    	for(var i = 0; i < numPages; i++){ // crée chaques headers
    		$('<div class = "page"/>').html(header).clone().on('ready', { newPage: i }, function(event){
    			currentPage = event.data['newPage'];
    		}).appendTo('body');
    	}
     
    	$('.page').each(function() {
    		$(tableAffichage).trigger('repaginate');
    		$(tableAffichage).clone().appendTo(this);
    	});
    });
    mais dans mon résultat j'ai uniquement les 10 premières lignes de chaques tableaux et tous les tableaux sur la même page

    ----------EDIT----------

    j'ai quelque chose de plus cohérent maintenant mais je n'arrive pas à changer les numéros de lignes que je veux afficher elles restent tout le temps les mêmes
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    $(document).ready(function(){
    	$('table').each(function() {
    		var currentPage = 0;
    		var numPerPage = 10;
    		var $table = $(this);
     
    		$table.on('repaginate', function() {
    			$table.find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
    		});
     
    		$table.trigger('repaginate');
    		var numRows = $table.find('tbody tr').length;
    		var numPages = Math.ceil(numRows / numPerPage);
    		var $pager = $('<div class = "pager"></div>');
     
    		for (var page = 0; page < numPages; page++) {
    			$('<div class = "page"></div>').html($table.trigger('repaginate').html()).on('ready', {
    				newPage: page
    			}, function(event) {
    				currentPage = page + 1;
    				// $table.trigger('repaginate');
    				// $(this).addClass('active').siblings().removeClass('active');
    			}).appendTo($pager).addClass('clickable');
    		}
     
    		$pager.insertBefore($table).find('div.page-number:first').addClass('active');
    	});
    });

  6. #6
    Membre averti Avatar de manry
    Homme Profil pro
    Alternant administration système et sécurité
    Inscrit en
    Janvier 2014
    Messages
    64
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Alternant administration système et sécurité
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2014
    Messages : 64
    Par défaut
    J'ai finalement trouvé la solution à mon problème merci a toi danielhagnoul d'avoir pris le temps de m'aider

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 15/05/2012, 12h41
  2. [XSL-FO] Tableau découpé sur 2 pages
    Par henri93 dans le forum XSL/XSLT/XPATH
    Réponses: 0
    Dernier message: 14/01/2011, 12h53
  3. verification de doublons dans un tableau
    Par bohemianvirtual dans le forum C
    Réponses: 11
    Dernier message: 25/05/2002, 12h21
  4. transmision de tableau en parametre
    Par Horus dans le forum C++Builder
    Réponses: 3
    Dernier message: 16/05/2002, 11h15
  5. Réponses: 4
    Dernier message: 13/05/2002, 16h43

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo