Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

JavaScript dynamic table remove duplicates

$
0
0

I am creating a dynamic table from a SharePoint list and displaying it on a page. the way I am looping through the listitems and finding a match with certain categories which incidentally creates a lot of duplicates. I found the code below to eliminate duplicates:

var seen = {};
          $('table tr').each(function() {
          var txt = $(this).text();
         if (seen[txt])
            $(this).remove();
        else
           seen[txt] = true;
        });

However, what I really need is to eliminate duplicates between two <tr>s with <tr class="content_header">. In other words, I would like to remove all duplicates that fall between two trs  with class="content_header". How can I modify the code above to achieve what I need? the above code removes all duplicates, but I need some duplicates as long as the duplicates are not within two rows with class="content_header" as these rows are my collapsible rows.

Any idea?


faye fouladi



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>