我怎么能隐藏第一列数据表?

时间:2015-04-07 13:55:36

标签: php jquery database zend-framework jquery-datatables

我有一张桌子,我想要隐藏一个列,我尝试了很多方法,这是其中之一

jQuery的:

var table = $('#client').DataTable({
responsive: true,
language: {
    url: '../DataTables/media/js/French.json'
},
"columnDefs": [
    { "visible": false, "targets": 0 }]
});

PHTML:

    <table id="client" class="display" cellspacing="0" width="100%">
        <input type="hidden" value="<?php echo $typeProfile;?>" id="idProfilSession"/>
        <thead>
            <tr>
                <th> N° client </th>
                <th> Société</th>
                <th> Nom </th>
                <th> Prénom </th>
                <th> Email</th>
                <th> Fixe </th>
                <th> Mobile </th>
                <th  align="center"> Action </th>
        <?php
            //if($accesAction){?>
                <!-- <th> Supprimer </th>  -->
                <!-- <th> Modifier </th>  -->
        <?php
            //}
            //if($accesCommentaire){
        ?>
                <!-- <th> Commentaire </th>  -->
        <?php //}?>
            </tr>
        </thead>
        <tbody>
            <?php
            foreach ($this->clients as $key => $client)
            {
                ?>
                <tr>
                    <td class='numClientCol'><?php echo $client->id; ?></td>
                    <td>
                        <?php echo ucfirst($client->Societe->nom); ?>
                        <button class="AfficherModifierSociete btn btn-default"
                                data-toggle="modal"
                                data-target="#formModifSociete"
                                data-whatever="@mdo"
                                data-id="<?php echo $client->Societe->idsociete;?>"
                                type="button" style="padding:0;padding:0;">
                            <a href="<?php echo $this->baseUrl() ?>/commentaire/index/idClient/<?php echo $client->id; ?>">
                                <img class="info-societe"
                                    style='height:25px;border:none;padding:0;padding:0;'
                                    title='modifier société'
                                    src='../images/editer-societe.png'/>
                            </a>
                        </button>
                    </td>
                    <td><?php echo $client->nom; ?></td>
                    <td><?php echo $client->prenom; ?> </td>
                    <td><?php echo $client->email; ?></td>
                    <td><?php echo $client->tel_fixe; ?> </td>
                    <td><?php echo $client->tel_mobile; ?> </td>
                    <td class="action "align="center">
                        <div class="btn-group" role="group" aria-label="...">
                            <?php if($accesAction){?>
                                <button type="button" class="supprimerClient btn btn-default" style="padding:0;padding:0;">
                                    <img type="button" class="supprimerClient btn btn-default" title='Supprimer' src='../images/supprimer.png' style='height:25px;border:none;padding:0;padding:0;cursor: pointer;'/>
                                </button>
                                <button data-toggle="modal"
                                        data-target="#formModifClient"
                                        data-whatever="@mdo"type="button"
                                        class="modifierClient btn btn-default" style="padding:0;padding:0;">
                                    <img title='Modifier'
                                          src='../images/modifier.png'
                                          style='height:25px;border:none;padding:0;padding:0;'/>
                                  </button>
                            <?php }?>
                            <?php if($accesCommentaire){ ?>
                                <a type="button" class="btn btn-default" style="padding:0;padding:0;" href="<?php echo $this->baseUrl() ?>/commentaire/index/idClient/<?php echo $client->id; ?>">
                                    <img style='height:25px;border:none;padding:0;padding:0;cursor: pointer;' alt="" src="../images/addCommentaire.png">
                                </a>
                            </button>
                            <?php }?>
                        </div>
                    </td>
                </tr>
                <?php
            }
            ?>
        </tbody>
</table>

我想隐藏这个colum“N°client”,但是没有CSS或javascript只有选项datables ...

还有其他隐藏列的方法吗?

1 个答案:

答案 0 :(得分:1)

也许不是数据表的方式,但你也可以使用css:

th:first-child,
td:first-child {
  display: none;
}