如何隐藏数据表的第一列


how i can hide the first column of 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>

我想隐藏这个列"N°客户端",但没有CSS或javascript,只有选项数据。。。

还有其他方法可以隐藏列吗?

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

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