Server side column filters alignment
Server side column filters alignment
chrisjai32
Posts: 10Questions: 4Answers: 1
I'm having problems with how I should fix my column filters' alignment After i put a non database column which will include my CRUD, My column filters were not properly functioning.
as you can see, my first name column searches for last name. Whenever i try anything to fix it it doesnt work, any help ?
http://i.imgur.com/s4CtqUR.jpg
Here's my script
<script type="text/javascript" language="javascript">
$(document).ready(function () {
var dataTable = $('#example').dataTable({
dom: 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "../assets/swf/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [
"select_all",
"select_none",
{
"sExtends": "collection",
"sButtonText": "Advance Tools",
"aButtons": [ "csv", "xls", "pdf", "print" ]
}
]
},
bProcessing: true,
bServerSide: true,
bRegex: true,
"oLanguage": {"sZeroRecords": "", "sInfoEmpty": ""},
sAjaxSource: "server_processing.php",
"fnServerData": function( sUrl, aoData, fnCallback ) {
$.ajax( {
"url": sUrl,
"data": aoData,
"success": fnCallback,
"dataType": "json",
"cache": false
} );
}
// "bStateSave" : true,
// "iDisplayLength": 10,
} )
.columnFilter({ sPlaceHolder: "head:before",
aoColumns: [
null,
null,
{type: "text" },
{type: "text" },
null,
null,
null,
null,
null,
and so on..
And my serverside processing.php
$aColumns = array('CandidateCode','Fname', 'Lname', 'Mobile1', 'Mobile2', 'Landline', 'EmailAddress', 'EmailAddress2', 'Portal', 'LinkedIn', 'primary_skill', 'YearStarted', 'AppForm', 'CreatedBy', 'DateCreated', 'EditedBy', 'DateEdited');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "CandidateCode";
/* DB table to use */
$sTable = "candidates_view";
/* Database connection information */
$gaSql['user'] = "root";
$gaSql['password'] = "";
$gaSql['db'] = "it_spac";
$gaSql['server'] = "localhost";
here's the last part with the crud that put in an array to make it go to row[0]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
$row[0] = "<a href='new_position.php?CandidateCode=".$aRow['CandidateCode']."' ><img src='../img/assign.png' style='width: 20px; height: 20px;' title='Assign to a Position'/></a>
<a href='editcandidate.php?CandidateCode=".$aRow['CandidateCode']."'><img src='../img/edit.png' style='width: 20px; height:20px;' title='Edit'/>
<a onclick='return confirm(\"Are you sure you want to delete this data ?\");' href='deletecandidate.php?CandidateCode=" .$aRow['CandidateCode'] . "'><img src='../img/delete.png' style='width: 20px; height: 20px; ' title='Delete'/></a>";
/* $row[] = '<img src="../img/assign.png">';*/
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
if ( $aColumns[$i] == "version" )
{
/* Special output formatting for 'version' column */
$row[] = ($aRow[ $aColumns[$i] ]=="0") ? '-' : $aRow[ $aColumns[$i] ];
}
else if ( $aColumns[$i] != ' ' )
{
/* General output */
$row[] = $aRow[ $aColumns[$i] ];
}
}
/* $row[] = "<a href='new_position.php?CandidateCode=".$aRow['CandidateCode'].'" >';
*/
$output['aaData'][] = $row;
}
echo json_encode( $output );
This discussion has been closed.
Answers
up