zeitlin / jquery-datatables-row-grouping

Automatically exported from code.google.com/p/jquery-datatables-row-grouping
0 stars 0 forks source link

aoGroups should not be an Array #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Internally, the map from group key to group object is kept in an array, 
aoGroups. That value is not used as an array, however; the length is always 
zero.

This matters when providing a callback method to fnOnGrouped, which takes the 
value of aoGroups as its only argument. You'd think you could pluck a specific 
property from this "array" using, for example, Underscore's pluck method:

  $('#my-rowgrouped-table').dataTable().rowGrouping({
    "fnOnGrouped" : function(aoGroups) {
      console.log("group keys: " + _.pluck(aoGroups, 'key').join());
    }
  });

But this fails, because the array is empty (and Underscore uses duck-typing 
based on the presence or absence of a length property). 

Since the "array"-ness of aoGroups isn't being used and gets in the way of 
reasonable usage, aoGroups should not be an array. (That probably means it 
should be renamed, too.)

Original issue reported on code.google.com by tpeie...@gmail.com on 6 Nov 2014 at 5:17

GoogleCodeExporter commented 9 years ago
FYI: I exported this dead project to github: 
https://github.com/djwoodward/jquery-datatables-row-grouping

Original comment by dan.jonw...@gmail.com on 27 Mar 2015 at 4:16