corrisoft / jquery-datatables-row-grouping

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

Error with deep property reading from data source #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create datatable with deep property reading from data source: use 
datatables.net example: 
http://datatables.net/release-datatables/examples/ajax/deep.html)
2. Set grouping on a column with mDataProp pointing to a deep property: add 
"oTable.rowGrouping({ iGroupingColumnIndex: 2 });" after table initialization

What is the expected output? What do you see instead?
Expected: Browsers should be grouped by platform.
Actual result: initialization fails with error: 
"jquery.dataTables.rowGrouping.js:122 - Uncaught TypeError: Cannot call method 
'toLowerCase' of undefined"

What version of the product are you using? On what operating system?
jquery 1.7.2
jquery.dataTables 1.9.1
jquery.dataTables.grouping 1.1.6

Please provide any additional information below.
The original code works for array data and simple properties, but not for 
nested properties
Code that determines "sGroup" value should use Datatables API function 
fnGetData() rather than relying on oSettings and aoColumnDefs.

Original file - line 288-289:
sGroupData = 
oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[properties.iGrouping
ColumnIndex];
if (sGroupData == undefined)
    sGroupData = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[oSettings.aoColumns[properties.iGroupingColumnIndex].mDataProp ]; 

Proposed patch - line 288-289:
sGroupData = this.fnGetData(nTrs[i], properties.iGroupingColumnIndex);
/* deleted line */

Patch file is attached

Original issue reported on code.google.com by ftay...@gmail.com on 13 May 2012 at 5:34

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 13 Jul 2012 at 10:51

GoogleCodeExporter commented 9 years ago
Hi,

Thank you for this fix it is included in the 1.2.2. version. See 
http://jquery-datatables-row-grouping.googlecode.com/svn/trunk/ajax_deep.html 
as example.

Regards,
Jovan

Original comment by joc...@gmail.com on 15 Jul 2012 at 11:22

GoogleCodeExporter commented 9 years ago
Version 1.2.7; this needs to be applied to secondary grouping as well.

Should be on line 417
Change
sGroupData2 = 
oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[properties.iGrouping
ColumnIndex2]; 

to

sGroupData2 = this.fnGetData(nTrs[i], properties.iGroupingColumnIndex2);

Original comment by mikerfac...@gmail.com on 20 Aug 2012 at 3:27

GoogleCodeExporter commented 9 years ago
I can confirm the above. I'm using 1.2.9 and was having issues with secondary 
grouping. The above fix solved my issue:

Line 423. Change:
sGroupData2 = 
oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[properties.iGrouping
ColumnIndex2];

to

sGroupData2 = this.fnGetData(nTrs[i], properties.iGroupingColumnIndex2);

Works flawlessly!

Original comment by yann...@verya.ca on 18 Feb 2014 at 7:20