Search
23679 results 3101-3110
Forum
- 27th Jun 2011Best method for changing columns headers into dropdown and calendar fieldsHi, I'd like to add filters with select dropdown AND calendar field to my table's column headers. I'm about to do it with fnInitComplete, and I wonder if it is the best way. Any advice? My actual config: "bJQueryUI": true, "bServerSide": true, "sAjaxSource": "index.php", "iDisplayLength": 100, "bScrollCollapse": true, "sScrollY":"1px", "bLengthChange": false, "bDeferRender": true, "bFilter": true, "bStateSave": true, "sPaginationType": "full_numbers", "fnDrawCallback": function(){ var maxH = parseInt($("#mainContainer").innerHeight() - 120); var tabH = $("#mainTable").height(); var finalH = tabH < maxH ? tabH : maxH; $("#mainContainer div.dataTables_scrollBody").height(finalH); } Many thanks!
- 4th May 2011[Please help]DataTables horizontal scrolling: column's width header and content doesn't equalI get that problem on Chrome and Safari (work great on FF, IE, Opera). I googled for a week but nothing can help! Here is the link to my site: http://lapvo3.com/news/modules.php?name=atntdatatable&lop=10A1&thang=11 ID of the sort table: example Please help me to solve that problem. Thanks a lot!
- 9th Apr 2011Problem with columnsFirst of all, I have to say that this is the best jquery plugin for dealing with tabular data that I have come across. Easy to integrate with lots of options, so keep up the good work guys. Now onto my issue. At the moment, I have a Datatable setup to display data from 6 fields. Everything works as expected but when I try to export to CSV, Excel or even Print, all I get is the same 6 fields being exported. How do I get all the fields exported? Is there a way I can get that done? Many thanks!
- 22nd Feb 2011Column headers not displaying properly because of hidden columns and column grouping?Hello, Thanks Alan for this wonderful plug-in. I have a table in which two first column are hidden. The colomn headers are not displaying properly for the last column group. (expense column). I have copied sample code below. [code] $(document).ready(function() { var oTable = $("#tblexample").dataTable( { "bPaginate": false, "bLengthChange": false, "bAutoWidth": false,"aaSorting": [[ 2, "asc" ]], "aoColumns": [ { "bVisible": false }, { "bVisible": false }, null, null, { "bSortable": false, sWidth: '90px'}, { "bSortable": false, sWidth: '90px'},{ "bSortable": false, sWidth: '90px'} , { "bSortable": false, sWidth: '90px'}, { "bSortable": false, sWidth: '90px'},{ "bSortable": false, sWidth: '90px'},{ sWidth: '90px' }, { "bSortable": false}, /* detail */{ "bSortable": false} /* detail */ ], "fnDrawCallback": function(){ //$('#tblpercentchange td').bind('mouseenter', function () { $(this).parent().children().each(function(){$(this).addClass('datatablerowhighlight');}); }); //$('#tblpercentchange td').bind('mouseleave', function () { $(this).parent().children().each(function(){$(this).removeClass('datatablerowhighlight');}); }); } }); }); </head> <body> <h1>Start demo</h1> <table id="tblexample"> <thead> <tr> <th rowspan="2">ID</th> <th rowspan="2">percent</th> <th rowspan="2">Name</th> <th rowspan="2">Phone</th> <th colspan="2">Salary</th> <th colspan="2">Income</th> <th colspan="2">Expense</th> <th rowspan="2">Change</th> <th rowspan="2">Detail</th> <th rowspan="2">Detail</th> </tr > <tr> <th>Nov10</th> <th>Dec10</th> <th>Nov10</th> <th>Dec10</th> <th>Nov10</th> <th>Dec10</th> </tr > </thead> <tbody> <tr class="odd"> <td>11111</td> <td>0.526</td> <td>Mr John}</td> <td>DDD</td> <td style="text-align:center;">11111</td> <td style="text-align:center;">2222</td> <td style="text-align:center;">3333</td> <td style="text-align:center;">44444</td> <td style="text-align:center;">55555</td> <td style="text-align:center;">66666</td> <td style="text-align:center;">77777</td> <td style="text-align:center;"><input class="submitdetails" type="submit" name="submit" value="NOV10"/></td> <td style="text-align:center;"><input class="submitdetails" type="submit" name="submit" value="DEC10"/></td> </tr> </tbody> [/code] Thanks.
- 23rd Nov 2010Hiding columns Server Side processingHello This code to hide the colum actually breaks the application and no row is shown. Dont know why, just copied it and pasted it. I m using version 1.7.2 [code] $(document).ready(function() { $('#ejemplo1').dataTable( { "aoColumns": [ /* id/ { "bVisible": false }, / from / null, / through / null, / to/ null, / duration / null, / to/ null, / price */ null ] "bProcessing": true, "bServerSide": true, "bJQueryUI": true, "sAjaxSource": "datatables/php/server_processing_data.php" } ); } ); [/code] anybody knows why ? regards
- 3rd Jun 2010¿Como Agregar Columnas? / How to add columns?Hola me gustar
- 31st May 2010Individual column filtering with Show/Hide columns dynamically #2"server_processing_filter_col.php" changed file from examples_support. [code] <?php /* MySQL connection / include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); $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<mysql_real_escape_string( $_GET['iSortingCols'] ) ; $i++ ) { $sOrder .= fnColumnToField(mysql_real_escape_string( $_GET['iSortCol'.$i] ))." ".mysql_real_escape_string( $GET['sSortDir'.$i] ) .", "; } $sOrder = substr_replace( $sOrder, "", -2 ); } / Filtering - NOTE this does not match the built-in DataTables filtering which does it * word by word on any field. It's possible to do here, but concerned about efficiency * on very large tables, and MySQL's regex functionality is very limited / $sWhere = ""; //this I add next variables $aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' ); $orig_search_values=array("Search engines","Search browsers","Search platforms","Search versions", "Search grades"); $array_cond = array(); /// ///this I added $i=0; foreach($aColumns as $key=>$value) { ${$aColumns[$i]}=$_GET[$value]; if(${$aColumns[$i]} !='undefined' and ${$aColumns[$i]} !=$orig_search_values[$i]) $array_cond[]=array($value,${$aColumns[$i]}); $i++; } //till this if ( $_GET['sSearch'] != "" ) { $sWhere = "WHERE ( engine LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ". "browser LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ". "platform LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ". "version LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ". "grade LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' )"; } ///this deleted / for ( $i=0 ; $i<$GET['iColumns'] ; $i++ ) { if ( $_GET['sSearch'.$i] != '' ) { if ( $sWhere != "" ) { $sWhere .= " AND "; } else { $sWhere .= "WHERE "; } $sWhere .= fnColumnToField($i) ." LIKE '%".mysql_real_escape_string( $GET['sSearch'.$i] )."%'"; } } */ //this I added foreach($array_cond as $cond) { if ( $sWhere != "" ) { $sWhere .= " AND "; } else { $sWhere .= "WHERE "; } $sWhere .= $cond[0] ." LIKE '%".mysql_real_escape_string( $cond[1] )."%'"; } //till this $sQuery = " SELECT SQL_CALC_FOUND_ROWS id, engine, browser, platform, version, grade FROM ajax $sWhere $sOrder $sLimit "; $rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error()); $sQuery = "SELECT FOUND_ROWS()"; $rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error()); $aResultFilterTotal = mysql_fetch_array($rResultFilterTotal); $iFilteredTotal = $aResultFilterTotal[0]; $sQuery = " SELECT COUNT(id) FROM ajax "; $rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error()); $aResultTotal = mysql_fetch_array($rResultTotal); $iTotal = $aResultTotal[0]; $sOutput = '{'; $sOutput .= '"sEcho": '.intval($_GET['sEcho']).', '; $sOutput .= '"iTotalRecords": '.$iTotal.', '; $sOutput .= '"iTotalDisplayRecords": '.$iFilteredTotal.', '; $sOutput .= '"aaData": [ '; while ( $aRow = mysql_fetch_array( $rResult ) ) { $sOutput .= "["; $sOutput .= '"'.str_replace('"', '\"', $aRow['engine']).'",'; $sOutput .= '"'.str_replace('"', '\"', $aRow['browser']).'",'; $sOutput .= '"'.str_replace('"', '\"', $aRow['platform']).'",'; if ( $aRow['version'] == "0" ) $sOutput .= '"-",'; else $sOutput .= '"'.str_replace('"', '\"', $aRow['version']).'",'; $sOutput .= '"'.str_replace('"', '\"', $aRow['grade']).'"'; $sOutput .= "],"; } $sOutput = substr_replace( $sOutput, "", -1 ); $sOutput .= '] }'; echo $sOutput; function fnColumnToField( $i ) { if ( $i == 0 ) return "engine"; else if ( $i == 1 ) return "browser"; else if ( $i == 2 ) return "platform"; else if ( $i == 3 ) return "version"; else if ( $i == 4 ) return "grade"; }
- 8th May 2010DataTables warning: Added data does not match known number of columnsWhat is wrong? /* POST data to server */ $(document).ready(function() { $('#inbox_received').dataTable( { "bJQueryUI": true, "sPaginationType": "full_numbers", "bFilter": false, "aaSorting": [[3,'desc']], "aoColumns": [{ "bVisible": false },null,null,{ "sType": "date" },null], "bProcessing": true, "bServerSide": true, "sAjaxSource": "inboxuser_received_msgs.do", "fnServerData": function ( sSource, aoData, fnCallback ) { $.ajax( { "dataType": 'json', "type": "POST", "url": sSource, "data": aoData, "success": fnCallback } ); } } ); } ); ID Received From Status Date Received Media Loading data from server JSON from server side: { "sEcho": "1", "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ { "emailsmsId": 2161, "fromName": 6578, "requestStatus": 82, "sentTime": { "date": 7, "day": 3, "hours": 8, "minutes": 11, "month": 3, "nanos": 0, "seconds": 22, "time": 1270653082000, "timezoneOffset": 420, "year": 110 }, "media": "DM" } ] }
- 3rd Aug 2026Problem with date type on 3.0 updatelooks like the date columns are still breaking it,
- 30th Jul 2026Several issues with DataTables after migrating from v2.3.8 to v3.0.0 (Bootstrap 4)doesn't know for that column's data. I actually regret