startRender count - Page 2

startRender count

2»

Answers

  • kthorngrenkthorngren Posts: 21,376Questions: 26Answers: 4,957
    edited February 2022 Answer ✓

    Thanks. Since you are using nested objects you will need to use pluck() twice, once for each level. Try this:

    var subLevelCount = rows.data().pluck( 'buono' ).pluck( 'n_bxd' ).unique().count();
    

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1
    edited March 2022

    @kthorngren i dont see your answer sorry but workssss thaaanks maaan!!

  • kthorngrenkthorngren Posts: 21,376Questions: 26Answers: 4,957

    Did you try my suggestion? I don't see that you changed the test case.

    Kevin

  • rf1234rf1234 Posts: 3,004Questions: 87Answers: 421

    Thanks Kevin! I had never used "pluck" before. Just tried it.

    I replaced this:

    ...
    var rows = dt.rows({ search: 'applied' }).data().toArray();
    var ctrGovdeptIdArray = rows.map(function(a){return a.ctr_govdept.id;});
    

    with this:

    ...
    var ctrGovdeptIdArray = dt.rows({ search: 'applied' }).data()
                           .pluck('ctr_govdept').pluck('id').toArray();
    

    Works!

Sign In or Register to comment.