Coder Social home page Coder Social logo

Empty result set about angular-datatables HOT 5 CLOSED

vivendi avatar vivendi commented on August 15, 2024
Empty result set

from angular-datatables.

Comments (5)

l-lin avatar l-lin commented on August 15, 2024

Good catch 👍 It's a bug I didn't consider.
I'm on it.

from angular-datatables.

l-lin avatar l-lin commented on August 15, 2024

Mmh I can't really find a solution within the module.
But, you can solve this by adding the ng-if directive, for example like this:

<table datatable="ng" dt-options="dtOptions" class="row-border hover" ng-if="users.length > 0">
    <thead>
        <tr>
            <th>date (ISO)</th>
            <th>name</th>
            <th>email</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        <tr dt-rows="" ng-repeat="user in users">
            <td>{{ user.date }}</td>
            <td>{{ user.name }}</td>
            <td>{{ user.email }}</td>
            <td>actions</td>
        </tr>
    </tbody>
</table>
<p ng-show="users.length == 0">No result</p>

from angular-datatables.

vivendi avatar vivendi commented on August 15, 2024

Yeah, that's what I'm doing now (the ng-if stuff). But I'd rather show the table with no rows. So the user can still see the table headers. Seems more user friendly to me.

But for now I'll stick with the ng-if solution.

from angular-datatables.

l-lin avatar l-lin commented on August 15, 2024

Code works if we give the array directly to the scope, but not working when fetching the data from promises 😢

from angular-datatables.

l-lin avatar l-lin commented on August 15, 2024

Fixed at last! 😄

from angular-datatables.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.