filtering an array of arrays that contain objects

  • Hello,

    in my report i've used the group by function to group all objects in different arrays based on a value they have in common

    so i get a sort of Array of arrays with inside objects grouped.

    previously when i wasn't using the group by functionality, i had an array with objects and it was pretty easy to filter them using this code below:

    • for removing previous row in the table after filtering

       while (Body.firstChild) {

    where Body is the <tbody> element

    • for filtering in the objects

            data = data.filter( function(item) {
                return item.OrderNumber.indexOf(FilterValue) !== -1

    Now i can't use this, since i'm also using in the handlebars this structure for generating the table

    {{#each orders}} 

    << creating the header of the table>>

     {{#each this}}

    <<here i create the rows that contain the data of each object in the array>>

    So my question is: how could i filter this data and eventually remove the rows that are not included in the filter having this structure of array?

    the array is represented like this:

    Array(3) [ (1) […], (1) […], (2) […] ]

    0: Array [ {…} ]

    1: Array [ {…} ]

    2: Array [ {…}, {…} ]

    length: 3

    <prototype>: Array []

    I'm new to jsreport, hope i made a clear explanation of the issue


  • It seems complicated to describe... Please rather prepare a minimal playground demo and I will take a look there. Thank you.

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.