search result
search result
croattila
Posts: 2Questions: 0Answers: 0
Hi!
First, i wanna thank you for this plugin, it make my job lot easier.
Second, i have a problem: I use php, mysql, ajax, json and its work well. I got the result from the server side, showing nicely in Datatable, but when i want to search in this table, it gives me result from entire table and not just from the filtered entries. Somebody can help me?
First, i wanna thank you for this plugin, it make my job lot easier.
Second, i have a problem: I use php, mysql, ajax, json and its work well. I got the result from the server side, showing nicely in Datatable, but when i want to search in this table, it gives me result from entire table and not just from the filtered entries. Somebody can help me?
This discussion has been closed.
Replies
Allan
<?php
session_start();
/*
* Script: DataTables server-side script for PHP and MySQL
* Copyright: 2010 - Allan Jardine
* License: GPL v2 or BSD (3-point)
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( 'OSZTALY', 'AZON', 'NEV', 'EV', 'MEGNYITD','UTMODD' );
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "AZON";
/* DB table to use */
$sTable = "iktfocsoport";
/* Database connection information */
$gaSql['user'] = "root";
$gaSql['password'] = "";
$gaSql['db'] = "gdm1";
$gaSql['server'] = "localhost";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/*
* MySQL connection
*/
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );
/*
* Paging
*/
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}
/*
* Ordering
*/
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
and script:
$('#mytable').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "minden_targy_json.php",
"bAutoWidth": false,
"bJQueryUI": true,
"bStateSave": true,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sRowSelect": "single",
"aButtons": [ "select_all", "select_none" ]
},
"oLanguage": {
"sProcessing": "Feldolgozás...",
"sLengthMenu": "_MENU_ találat oldalanként",
"sZeroRecords": "Nincs a keresésnek megfelelő találat",
"sInfo": "Találatok: _START_ - _END_ Összesen: _TOTAL_",
"sInfoEmpty": "Nulla találat",
"sInfoFiltered": "(_MAX_ összes rekord közül szűrve)",
"sInfoPostFix": "",
"sSearch": "Keresés:",
"sUrl": "",
"oPaginate": {
"sFirst": "Első",
"sPrevious": "Előző",
"sNext": "Következő",
"sLast": "Utolsó"
}
}
} );
of course, its wrapped by $(document).ready(function(){}
Thanks!