0

J'ai utilisé des modèles blaze dans mon projet météore. J'ai codé toutes les tables dans les modèles flamboyants. a utilisé Meteor/package de recherche facile pour rechercher des données de table. et utiliser la pagination de kuronin pour la pagination de base d'abonnement.Comment utiliser les données bootstrap dans Meteor JS

Maintenant, je veux convertir ces tables en tables de données. Quelle est la meilleure façon de le faire?

Ceci est ma base de code.

<table class="table table-hover am-customers-table-2" id="mytable"> 
    <thead> 
     <tr> 
      <th width="20%"><label>Customer Name</label></th> 
      <th width="15%"><label>Phone Number</label></th> 
      <th width="35%"></th> 
      <th width="5%"></th> 
      <th width="10%"><label>Actions</label></th> 
      <th width="10%"></th> 
     </tr> 
    </thead> 
    <tbody> 
    <!-- {{#EasySearch.Each index=searchCustomersIndex }} --> 
    {{#each documents}} 
     <tr style="{{#if flagStatus}}background-color: #FB299D33;{{/if}}"> 
      <td> 
       <div class="single-line-list-item"> 
        <span class="number">{{getFirstLettersOfTheName name}}</span> 
        <div class="data"> 
         <span>{{name}}</span> 
        </div> 
       </div> 
      </td> 
      <td> 
       <span>{{number}}</span> 
      </td> 
      <td> 

      </td> 
      <td> 

      </td> 
      <td> 
      {{#if flagStatus}} 
       <button class="btn btn-sm btn-success markAsFlag" style="float: left">UnFlag</button> 
      {{else}} 
       <button class="btn btn-sm btn-danger customerMarkAsFlag" style="float: left">Flag</button> 
      {{/if}} 
      </td> 
      <td> 
       <a href="customer/{{_id}}"><button class="btn btn-sm btn-default" style="float: left">View Profile</button></a> 
      </td> 
     </tr> 
    <!-- {{/EasySearch.Each}} --> 
    {{/each}} 
    </tbody> 
</table> 
+2

Vous pouvez essayer le paquet sous forme de tableau: https://github.com/aldeed/meteor-tabular. –

Répondre

0

Tu ne peux pas simplement le dataTable initialiser dans .onRendered comme ceci:

Template.onRendered(function() { 
    this.$('table.table').dataTable(); 
});