Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82042

Return ALL Distinct Column Values - Server Side

$
0
0
My project is located at:
http://www.blackmagicms.com/regex/Vendor/sandbox/datatables/index4.html

I'm looking to return all Distinct values from the Vendor column in the database (not just those currently displayed) given the filters currently set by the user. I then want to display that information to the user in the header of the table. A little guidance or even pointing me in the right direction would be greatly appreciated. I saw the fnGetColumnData function, but from what I could tell, it doesn't work with Server Side processing.

My initial attempt was to add a parameter to the JSON output via something like this... however I wasn't sure how to get at that JSON value via existing Datatables methods:

        $sQuery = "
		SELECT SQL_CALC_FOUND_ROWS `".str_replace(" , ", " ", implode("`, `", $aColumns))."`
		FROM   $sTable
		$sWhere
		$sOrder
		";
        
	$vResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
        foreach($vResult as $value){
            $vList .= $value;
        }
........
$output = array(
		"sEcho" => intval($_GET['sEcho']),
		"iTotalRecords" => $iTotal,
		"iTotalDisplayRecords" => $iFilteredTotal,
                "iVendorList" => $vList,
		"aaData" => array()
	);
........
echo json_encode( $output );


Thank you in advance!

Viewing all articles
Browse latest Browse all 82042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>