JavaScript Footables column sorting is duplicating rows in table, Why? footable column sorting

I am adding footables to a table but the table has to have a tbody for each row. This is because I am adding footable sorting and filtering to an existing system that generates the html this way.

It seems to be causing the column sorting at the to be duplicating the table rows each time you try to sort the table by column heading and I cant see why.

The table structure is kinda like this:

<table data-filter="#filter" class="footable table demo">
<thead>
    <tr>
        <th>Name</th>
        <th>Job Title</th>
        <th>Status</th>
        <th>Description</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>Name1</td>
        <td>Job Title1</td>
        <td>Active</td>
        <td>Description1</td>
    </tr>
</tbody>
<tbody>
    <tr>
        <td>Name2</td>
        <td>Job Title2</td>
        <td>Disabled</td>
        <td>Description2</td>
    </tr>
</tbody>
</table>

javascript:

$(function () {
    $("table").footable().bind("footable_filtering", function (e) {
        var selected = $(".filter-status").find(":selected").text();
        if (selected && selected.length > 0) {
            e.filter += (e.filter && e.filter.length > 0) ? " " + selected : selected;
            e.clear = !e.filter;
        }
    });

    $(".clear-filter").click(function (e) {
        e.preventDefault();
        $(".filter-status").val("");
        $("table.demo").trigger("footable_clear_filter");
    });

    $(".filter-status").change(function (e) {
        e.preventDefault();
        $("table.demo").trigger("footable_filter", {
            filter: $("#filter").val()
        });
    });
});

I have also set up a working jsfiddle that demonstrates the issue:https://jsfiddle.net/35ht6kup/9/

Anybody have any idea how to resolve this?

Answer:1

The backend is developed by Spring MVC and hosted in tomcat. When I use postman dev tool in Chrome to test the endpoint (Restful), everything is working fine. The "Access-Control-Allow-Origin", "*" ...

The backend is developed by Spring MVC and hosted in tomcat. When I use postman dev tool in Chrome to test the endpoint (Restful), everything is working fine. The "Access-Control-Allow-Origin", "*" ...

  1. cors issue java
  2. cors issue java spring
  3. cors problem java
  4. cors issue fix in java
  5. cors issue in web api java

Is there a way to find all the child elements of a div that has id like:- child_*_of_parent HTML <div id="parent"> <div id=child_1_of_parent>...</div> <div id=...

Is there a way to find all the child elements of a div that has id like:- child_*_of_parent HTML <div id="parent"> <div id=child_1_of_parent>...</div> <div id=...

I'm using Angular(UI)-Google-Maps (2.1.5) and AngularJS (1.3.13) I want a marker that is always in the center of the map. The problem is that the marker only updates its position when I stop dragging....

I'm using Angular(UI)-Google-Maps (2.1.5) and AngularJS (1.3.13) I want a marker that is always in the center of the map. The problem is that the marker only updates its position when I stop dragging....

  1. angular google maps api
  2. angular google maps component
  3. angular google maps example
  4. angular google maps autocomplete
  5. angular google maps npm
  6. angular google maps geocoding
  7. angular google maps heatmap
  8. angular google maps directions
  9. angular google maps marker
  10. angular google maps types
  11. angular google maps add marker
  12. angular google maps not showing
  13. angular google maps documentation
  14. angular google maps search box example
  15. angular google maps cluster example
  16. angular google maps change marker icon
  17. angular google maps directions example
  18. angular google maps get current location
  19. angular google maps tutorial
  20. angular google maps github

i'm loading somthing like this in DOM using AJAX: <div class="elm_class"></div> <div class="elm_class"></div> <div class="elm_class"></div> and then I need to ...

i'm loading somthing like this in DOM using AJAX: <div class="elm_class"></div> <div class="elm_class"></div> <div class="elm_class"></div> and then I need to ...

  1. protractor wait for multiple elements