Datatable+ServerSide+MultipleTable by Join Table

Datatable+ServerSide+MultipleTable by Join Table

jadhoojadhoo Posts: 4Questions: 2Answers: 0

Dear Allan,

First of all thanks for the wonderful tool, its really a handy one.

I was trying to use the datatable serverside mode for my PHP project. The following are my include files FYI.



<link rel="stylesheet" type="text/css" href="/scripts/datatable/jquery.dataTables.css" />

I am facing 3 main issues, they are

1) The datatable displays records from the server , but when i search its triggering an error "DataTables warning: table id=example1 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1" ,

the following is my server side code :-

$sWhere = " WHERE Tab1.ID = Tab2.Nationality
AND Tab2.ID = Tab3.MemberID
AND Tab5.ID = Tab4.EventID
AND Tab4.ID = Tab3.GroupID
AND Tab5.ID= 853 ";

        if (isset($_GET['sSearch']) && $_GET['sSearch'] != '') {  
            $sWhere .= ' AND (';  
            for ($i=0; $i<count($aColumns) ; $i++) { 
                if (isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == 'true') {
                    $sWhere .= '' . $aColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch'])."%' OR "; 
                }
            }
            $sWhere = substr_replace( $sWhere, '', -3 );
            $sWhere .= ')';
        }  

$query1 = "SELECT
Tab2.ID AS LOCID,
Tab2.PassportName as PassportName,
Tab2.OtherName as OtherName,
Tab2.Sex as Sex,
Tab2.DOB as DOB,
Tab1.Name AS Country,
Tab2.Designation as Designation,
Tab2.RegID as RegID
FROM
Tab5, Tab4,Tab3
LEFT JOIN Tab6 ON (Tab3.UserID=Tab6.ID),
Tab2 {$sWhere} {$sOrder} {$sLimit} " ;

where could i went wrong ???

2) The datatable style for the pagination is not working well for me (its just displaying the numbers without space between the pages) , i try not to include my own stylesheet as i was thinking it may be conflicting the datatable style, but still no diffrence.

3) I want to include Tabs for my pages, but when i include the 3 files (mentioned above) for the datatables, the tab is not working.

Please help. Thank a lot.

Answers

  • jadhoojadhoo Posts: 4Questions: 2Answers: 0
    edited June 2014

    my Datatable include files
    scripts/datatable/jquery-1.10.2.min.js">
    scripts/datatable/jquery.dataTables.js">
    <link rel="stylesheet" type="text/css" href="/scripts/datatable/jquery.dataTables.css" />

    my $aColumns array is as follows ..
    $aColumns = array("PassportName", "OtherName", "Sex", "DOB", "Designation", "RegID", "abbr");

This discussion has been closed.