Datatables search, filter, and export with Firebase

830 views
Skip to first unread message

Mohammed Sohail

unread,
May 29, 2016, 11:00:34 AM5/29/16
to Firebase Google Group
I have a CRUD app powered by angular. Recently I added datatables to it in order to search, filter, sort,export and hide columns using the power of datatables. Unfortunately it returns the Firebase references in the various columns {{contact.name}} {{contact.email}} (There are 4 more columns) when I use any datatables feature such as search it returns the Firebase reference instead of a field. Is there a way to fix this? I really need those datatable features at the same time use Firebase.
$(document).ready(function() {
    $
('#contacts').DataTable( {
        dom
: 'Bfrtip',
        buttons
: [
           
'copyHtml5',
           
'excelHtml5',
           
'csvHtml5',
           
'pdfHtml5'
       
]
   
} );
} );
<table id="contacts" class="table table-striped table-hover" >
 
<thead>
   
<tr>
     
<th>Name</th>
     
<th>Phone</th>
     
<th>Area</th>
     
<th>Occupation</th>
     
<th>E-mail</th>
         
<th> Actions </th>
   
</tr>
 
</thead>
 
<tbody>
   
<tr ng-repeat="contact in contacts">
     
<td>{{contact.name}}</td>
     
<td>{{contact.phone}}</td>
     
<td>{{contact.area}}</td>
     
<td>{{contact.work}}</td>
     
<td>{{contact.email}}</td>
     
<td><a href="#/edit/{{contact.$id}}" class="btn btn-raised btn-xs btn-warning">Edit</a> <a class="btn btn-raised btn-xs btn-danger" ng-click="removeContact(contact.$id)">Delete</a></td>

   
</tr>
 
</tbody>
</table>



Jacob Wenger

unread,
May 31, 2016, 2:29:31 AM5/31/16
to fireba...@googlegroups.com
Can you share the JavaScript code where you are actually reading from Firebase? Without that, we won't be able to help that much. If you have a DataSnapshot, you should just be able to call val() on it to get the data you want. Also, are you using AngularFire or just the vanilla JavaScript SDK? Finally, what version of the Firebase and Angular SDKs are you using?

Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2cd3befa-0a5f-44e1-9d45-482b881d4b25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages