datatable 1.8.0 and array-type column data rendering
datatable 1.8.0 and array-type column data rendering
Soobok Lee
Posts: 2Questions: 0Answers: 0
I have a project which has array-type column data in the datatable input.
Prior to 1.8.0, fnUpdate() function had no problem with my data.
Version 1.8.0 fnUpdate() began to try to render ANY array column object as if it were top-level table array
and gives errornous rendering with an alert box.
I loves so hard this datatable plugin.
so, I had to modify datatable javascript source file so that fnUpdate() has
additional bColumnData boolean parameter for recursive call
upon child column data from top-level fnUpdate() call.
Here goes my "patch":
[code]
1917a1918
> * bool:bColumnData - treat mData as a column data even if it is of type array
1919c1920
< this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
---
> this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction, bColumnData )
1926c1927
< if ( $.isArray(mData) && typeof mData == 'object' )
---
> if ( $.isArray(mData) && typeof mData == 'object' && bColumnData==undefined)
1932c1933
< 'columns as the table in question - in this case '+oSettings.aoColumns.length );
---
> 'columns as the table in question - in this case '+oSettings.aoColumns.length+"/"+mData.length );
1940c1941
< this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
---
> this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false, true );
1943c1944
< else if ( typeof mData == 'object' )
---
> else if ( typeof mData == 'object' && bColumnData==undefined)
1950c1951
< this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
---
> this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false, true );
[/code]
Soobok Lee
Prior to 1.8.0, fnUpdate() function had no problem with my data.
Version 1.8.0 fnUpdate() began to try to render ANY array column object as if it were top-level table array
and gives errornous rendering with an alert box.
I loves so hard this datatable plugin.
so, I had to modify datatable javascript source file so that fnUpdate() has
additional bColumnData boolean parameter for recursive call
upon child column data from top-level fnUpdate() call.
Here goes my "patch":
[code]
1917a1918
> * bool:bColumnData - treat mData as a column data even if it is of type array
1919c1920
< this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
---
> this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction, bColumnData )
1926c1927
< if ( $.isArray(mData) && typeof mData == 'object' )
---
> if ( $.isArray(mData) && typeof mData == 'object' && bColumnData==undefined)
1932c1933
< 'columns as the table in question - in this case '+oSettings.aoColumns.length );
---
> 'columns as the table in question - in this case '+oSettings.aoColumns.length+"/"+mData.length );
1940c1941
< this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
---
> this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false, true );
1943c1944
< else if ( typeof mData == 'object' )
---
> else if ( typeof mData == 'object' && bColumnData==undefined)
1950c1951
< this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
---
> this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false, true );
[/code]
Soobok Lee
This discussion has been closed.
Replies
Thanks,
Allan
[
["1","홍길동","1154315","etc1",[["test1@daum.net","2011-03-04"],["test1@naver.com","2009-07-06"],["test4@naver.com",",hide"],["test5?@naver.com",""]],"2011-03-04","show"],
["2","홍길순","2154315","etc2",[["test2@daum.net","2009-09-26"],["test2@naver.com","2009-05-21,hide"],["lsb@naver.com","2010-03-05"],["lsb3@naver.com",",hide"],["sooboklee9@daum.net","2010-03-05"]],"2010-03-05","show"]
]
Regards,
Allan