styling fnGetData results.

styling fnGetData results.

WavfactWavfact Posts: 12Questions: 0Answers: 0
edited December 2010 in General
I am trying to style the results of fnGetData but its not rendering properly.. I am using a theme I puchased so if I use tables then its not looking the way I want..

Does the fnGetData function only return TR's and TD's?

The page is listed here (sorry, had to change the .'s to (@) do spam bots don't pick up the email addresses listed):

www(@)fisheragservice(@)com/tm/use(@).html

[code]
function InitTables () {
var oTable;

/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var aData = oTable.fnGetData( nTr );
//var sOut = '';
var sOut = '';

sOut += '';

sOut += '';
sOut += 'Branch: '+aData[13]+'';
sOut += ''+aData[7]+'';
sOut += ''+aData[8]+', '+aData[9]+' , '+aData[10]+'';
sOut += '';

sOut += '';
sOut += 'Phone:'+aData[11]+'';
sOut += 'FAX:'+aData[12]+'';
sOut += '';
sOut += '';

sOut += '';
sOut += 'Join Data:'+aData[14]+'';
sOut += 'Last Login:'+aData[15]+'';
sOut += 'Maps Created:'+aData[16]+'';
sOut += '';

return sOut;
}
oTable = $('.datatable').dataTable({
'bLengthChange': true,
'bPaginate': true,
'sPaginationType': 'full_numbers',
'iDisplayLength': 10,
'bInfo': true,
'bProcessing': true,
'bServerSide': true,
'sAjaxSource': './includes/user_data.php',
'oLanguage':
{
'sSearch': 'Search all columns:',
'oPaginate':
{
'sNext': '>',
'sLast': '>>',
'sFirst': '<<',
'sPrevious': '<'
}
},
"aoColumns": [
{ "sClass": "center", "bSortable": false, "bSearchable": false },
null,
null,
null,
{"bSearchable": false },
{"bSearchable": false },
{"bSearchable": false },
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{"bSearchable": false, "bVisible": false},
{ "bSortable": false, "bSearchable": false,
"fnRender": function(oObj) {
var cId = oObj.aData[0];
return ' ';
}

}]

});

$('#datatable tbody td img').live( 'click', function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_close') )
{
/* This row is already open - close it */
this.src = "images/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "images/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );

}
[/code]

Replies

  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    Unfortunately I just get a blank page with your link, but fnGetData will give you an array of data, not a DOM node: http://datatables.net/api#fnGetData . If you want the node you've got it with the nTr variable already and that can be styled.

    Allan
  • WavfactWavfact Posts: 12Questions: 0Answers: 0
    edited December 2010
    Sorry, was users.html

    I did het it sorted.. Forgot to post back here..

    Thanks!
This discussion has been closed.