/* Formating function for row details */
function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '<table cellpadding="7" cellspacing="0" border="0" style="padding-left:50px;">';
sOut += '<tr><td>Rendering engine:</td><td>'+aData[11]+' '+aData[12]+'</td></tr>';
sOut += '</table>';
return sOut;
}
( "#srchbtn" ).button
({ icons: { primary: "ui-icon-gear" }
}).click(function(){
/*
* Insert a 'details' column to the table
*/
var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = '<img src="../examples_support/details_open.png">';
nCloneTd.className = "center";
$('#example thead tr').each( function () {
this.insertBefore( nCloneTh, this.childNodes[0] );
} );
$('#example tbody tr').each( function ({
this.insertBefore( nCloneTd.cloneNode( true ), this.childNodes[0] );
} );
var oTable = $('#example').dataTable( {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
],
"aaSorting": [[ 2, "asc" ]],
bProcessing: true,
bServerSide: true,
bDestroy: true,
bJQueryUI: true,
bAutoWidth: false,
sPaginationType: 'full_numbers',
sAjaxSource: 'serverside/final_members.php',
bDeferRender:true,
fnServerData: function (sSource,aoData,fnCallback ) {
aoData.push( { "name": "pPin", "value": document.mempininq.pin.value } );
aoData.push( { "name": "plName", "value": document.mempininq.lname.value } );
aoData.push( { "name": "pfName", "value": document.mempininq.fname.value}); $.ajax( {
"dataType": 'json',
"type": 'GET',
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
});
$('#example 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(oTable, nTr), 'details' );
}
} );
"aoColumnDefs": [
{
"sTitle": "+",
"mDataProp": null,
"bSortable" : false,
"bSearchable": false,
"sClass": "center",
"sDefaultContent": '<img src="/images/details_open.png" />',
"aTargets": [ 0 ],
"sWidth": 20
},
{ "sTitle": "Name", "mDataProp": "name", "aTargets": [ 1 ]},
{ "sTitle": "Type", "mDataProp": "type", "aTargets": [ 2 ], "sWidth": '33%' },
//...
/* Data column sorting (the column which the sort for a given column should take place on) */
// before :
oSettings.aoColumns[i].iDataSort = aiInvertMapping[ oSettings.aoColumns[i].iDataSort ];
// after :
oCol = oSettings.aoColumns[i];
for ( j=0, jLen=oCol.aDataSort.length ; j<jLen ; j++ )
{
oCol.aDataSort[j] = aiInvertMapping[ oCol.aDataSort[j] ];
}
/* Body */
// before :
fnDomSwitch( oSettings.aoData[i].nTr, iVisibleIndex, iInsertBeforeIndex );
// after :
if ( oSettings.aoData[i].nTr !== null )
{
fnDomSwitch( oSettings.aoData[i].nTr, iVisibleIndex, iInsertBeforeIndex );
}
(Patch code come from ColReorder plugin code).Allan, it is possible to add resize option in your code ?
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.