In the Server-side processing DataTables in how to use the multi-table query . Thank you!
↧
In the Server-side processing DataTables in how to use the multi-table query . Thank you!
↧
sum filtered rows/columns
Hi
I want to be able to sum a column of data after a filter has been applied using the plug in column filter.
I found this thread: http://datatables.net/forums/discussion/2053/fnfootercallback-sum-column-after-filter/p1
Which partly relates to the solution but I'm unclear on how I can use the object created:
._('td:nth-child(4)', {"filter": "applied"})
I'm a novice at jquery - I assume I need to go through each cell in the column and add the value but I havent a clue on how to start this
Can you point me in the right direction please
Thanks
I want to be able to sum a column of data after a filter has been applied using the plug in column filter.
I found this thread: http://datatables.net/forums/discussion/2053/fnfootercallback-sum-column-after-filter/p1
Which partly relates to the solution but I'm unclear on how I can use the object created:
._('td:nth-child(4)', {"filter": "applied"})
I'm a novice at jquery - I assume I need to go through each cell in the column and add the value but I havent a clue on how to start this
Can you point me in the right direction please
Thanks
↧
↧
Ajax actions not working with jquery 1.9
Hi,
I use php code for generated table rows to work with DataTable. There i have an <a> tag in each row where on click on them an ajax action triggered. But this ajax action only work on the first set of record, if i go to page number 2 its not working.
Any help on this will be appreciated.
Thanks
I use php code for generated table rows to work with DataTable. There i have an <a> tag in each row where on click on them an ajax action triggered. But this ajax action only work on the first set of record, if i go to page number 2 its not working.
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { oTable = $('#dtplugin').dataTable({ "oLanguage": { "sSearch": "" }, "aoColumnDefs": [{ "bSortable": false, "aTargets": [3] }] }); }); </script>
Any help on this will be appreciated.
Thanks
↧
Escaping HTML with datatables
I have datatables set up like so :
To my understanding when using datatables ajax source like in this example :
http://www.datatables.net/examples/data_sources/ajax.html
you leave the space in between <tbody> </tbody> empty using the datatables to retrieve the data.
My problem is in the security aspect of this, and all in all how do I allow datatables to do the samething I am currently doing (look at code above) and then have it use ajax processing. I am kind of confused. I also have another question that I would ask but I will ask that after your response to this question.
Also Allen I am very grateful for all your doing. I know you get this a lot, but me and my College are loving the design of DataTables.
The application I am writing might be expanded to serve multiple college offices, and even different colleges. And on all my presentations I get "Those tables look awesome" "I love the search features" so I am very thankful for all you are doing. There are times I get pissed of datatables but thats probably my fault as I suck with client side scripting. I'm a php guy.
<tbody> <?php $options = array("" => "", 'start' => 'Start Session', 'stop' => 'Student Not Present', 'abandon' => 'End Session', ); foreach ($waiting as $row) { ?> <tr> <td><?php echo htmlspecialchars($row['id'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo anchor('studentqueue_controller/history/'.urlencode($row['anum']). '', htmlspecialchars($row['anum'], ENT_QUOTES, 'UTF-8'), 'target="_blank"'); ?></td> <td><?php echo htmlspecialchars($row['first'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($row['last'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($row['SECOND'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($row['reason'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($row['studentcomments'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($row['aidyear'], ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($row['counselorcomments'], ENT_QUOTES, 'UTF-8'); ?></td> <td> <?php echo form_open('studentqueue_controller/counselorscreen/' .urlencode($row['id']). ''); ?> <?php echo form_dropdown('options', $options, ""); ?> <?php echo form_submit('submit', 'Submit'); ?> <?php echo form_close(); ?> </td> </tr> <?php } ?> </tbody>
To my understanding when using datatables ajax source like in this example :
http://www.datatables.net/examples/data_sources/ajax.html
you leave the space in between <tbody> </tbody> empty using the datatables to retrieve the data.
My problem is in the security aspect of this, and all in all how do I allow datatables to do the samething I am currently doing (look at code above) and then have it use ajax processing. I am kind of confused. I also have another question that I would ask but I will ask that after your response to this question.
Also Allen I am very grateful for all your doing. I know you get this a lot, but me and my College are loving the design of DataTables.
The application I am writing might be expanded to serve multiple college offices, and even different colleges. And on all my presentations I get "Those tables look awesome" "I love the search features" so I am very thankful for all you are doing. There are times I get pissed of datatables but thats probably my fault as I suck with client side scripting. I'm a php guy.
↧
click handler with hidden index column
I have a table which contains a unique id column - this is used to create a click handler to move to a new page. I don't want the id column to be visible, however - this will be used in a mobile app and there isn't enough width.
The data is held in a javascript array.
The code below works but also shows the id column as full width, even though it is set to 1% width.
I have tried making the column hidden but then I cannot get the id from the handler <td> element, column [0] returns the 'Name' content.
Another odd thing is that the column titles are all bunched up to the left, until I type a character in the search box when the titles re-arrange perfectly. This happen with or without autoWidth set.
I have searched the forum and found similar questions but not really found an answer.
The pages can be viewed at http://www.timetrials.org.uk : log in with username 'test' and password 'pw', then go to 'Riders & Clubs' and 'Rider List'.
html is:
<p id="ridersList" style="font-family:Verdana;font-size:20px;">No riders loaded</p>
code:
The data is held in a javascript array.
The code below works but also shows the id column as full width, even though it is set to 1% width.
I have tried making the column hidden but then I cannot get the id from the handler <td> element, column [0] returns the 'Name' content.
Another odd thing is that the column titles are all bunched up to the left, until I type a character in the search box when the titles re-arrange perfectly. This happen with or without autoWidth set.
I have searched the forum and found similar questions but not really found an answer.
The pages can be viewed at http://www.timetrials.org.uk : log in with username 'test' and password 'pw', then go to 'Riders & Clubs' and 'Rider List'.
html is:
<p id="ridersList" style="font-family:Verdana;font-size:20px;">No riders loaded</p>
code:
dataArray = new Array(ridersdata.length); for (i = 0; i < ridersdata.length; i++) { var rider = ridersdata[i]; dataArray[i] = new Array(rider.ID, rider.Name, rider.Club, rider.Category, inEvent(rider)); } $('#ridersList').html('<table class="display" id="riders"></table>'); var oTable = $('#riders').dataTable({ "sScrollY": size, //"bjQueryUI": true, "bPaginate": false, "bScrollCollapse": true, "aaData": dataArray, "bAutoWidth": false, "aoColumns": [ { "sWidth": "1%" }, { "sTitle": "Name" }, { "sTitle": "Club" }, { "sTitle": "Cat." }, { "sTitle": "Event?" } ] }); $('#riders tbody tr').on('click', function () { var nTds = $('td', this); var id = $(nTds[0]).text(); // create a new page based on id......
↧
↧
fnGetPosition Returns "Cannot read property 'nTr' of undefined" When Called on Table w/ Fixed Cols
I have a table which is split using FixedColumns(oTable,{"iLeftColumns":5,"iLeftWidth":500});
One of the columns on the left side is "editable"; and, after editing the cell I'm trying to use "oTable.fnGetPosition(this)".
The output of "console.log(oTable.fnGetPosition(this))" is "null". If I shift the editable column to the right side of the split, the function returns three values, but the second value starts with zero for the first column to the right of the split (as though the columns to the left of the split aren't there).
The main thing I'm looking for is the first number, the row number of the cell just edited.
Thanks.
One of the columns on the left side is "editable"; and, after editing the cell I'm trying to use "oTable.fnGetPosition(this)".
The output of "console.log(oTable.fnGetPosition(this))" is "null". If I shift the editable column to the right side of the split, the function returns three values, but the second value starts with zero for the first column to the right of the split (as though the columns to the left of the split aren't there).
The main thing I'm looking for is the first number, the row number of the cell just edited.
Thanks.
↧
IE 7/8 Page Button Strange Behavior
In IE 7 and 8 using server side paging, the "Next" button behaves like the "First" button, the "First" button behaves like the "Previous" button and the "Previous" button behaves like the "Next" button. Has anyone run into this and what was the fix?
↧
Errors on initialization
I am getting started with DataTables and Firebug is not happy.
It is giving me error on the plug in file which is very odd.
Type Error - oCol is undefined on line 820 of the js/jquery.dataTables.js file
I include the full initialization code within the head section of my page:
Anybody has a clue?
It is giving me error on the plug in file which is very odd.
Type Error - oCol is undefined on line 820 of the js/jquery.dataTables.js file
oCol.fnSetData( oData, val );
I include the full initialization code within the head section of my page:
<script type="text/javascript" src="jquery/jquery-1.7.2.js"></script> <script type="text/javascript" charset="utf-8" src="DataTables/media/js/jquery.dataTables.js"></script> <script> $(document).ready(function() { $("#myTable").dataTable(); }); </script>
Anybody has a clue?
↧
Two Tables in 1 View (Multiple Issues)
Hi,
I am developing a c#.Net MVC4 application. I've created two datatables which are each located in separate partial views. Both partial views (PartialView1) and (PartialView2) are then loaded and displayed together in another view.
My problems are that: *FixedColumn functionality is not working for either table
*Sometimes one table will be correctly constrained to the div element boundaries in which its located and other times it
will stretch across the entire page (appears to occur randomly, this happens to both tables but it is always only one or
the other)
*First table always displays a footer with the selectable pages 1 & 2 although pagination is set to false
(this never occurs for the 2nd table)
Ive used firebug and inspect element in Chrome but do not see any script errors other than the one regarding the browser check incompatibility that is being fixed in the most current build of FixedColumn.
My debugger reference: ojoveq
I'm not familiar with how to use DataTables live or JS Fiddle to test my problems.
Table 1 Code:
Table 2 Code:
Combined View Code:
I am developing a c#.Net MVC4 application. I've created two datatables which are each located in separate partial views. Both partial views (PartialView1) and (PartialView2) are then loaded and displayed together in another view.
My problems are that: *FixedColumn functionality is not working for either table
*Sometimes one table will be correctly constrained to the div element boundaries in which its located and other times it
will stretch across the entire page (appears to occur randomly, this happens to both tables but it is always only one or
the other)
*First table always displays a footer with the selectable pages 1 & 2 although pagination is set to false
(this never occurs for the 2nd table)
Ive used firebug and inspect element in Chrome but do not see any script errors other than the one regarding the browser check incompatibility that is being fixed in the most current build of FixedColumn.
My debugger reference: ojoveq
I'm not familiar with how to use DataTables live or JS Fiddle to test my problems.
Table 1 Code:
<script type="text/javascript" src="../../Scripts/jquery-1.9.1.js"></script> <script type="text/javascript" src="../../Scripts/DataTables-1.9.4\extras\FixedColumns\media\js\FixedColumns.min.js"></script> <script type="text/javascript" src="../../Scripts/DataTables-1.9.4\media\js\jquery.dataTables.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function () { var oTable1 = $('#example1').dataTable({ "sScrollX": "0", "sScrollY": "200px", "bPaginate": false, "bLengthChange": false, "bFilter": false, "bSort": false, "bInfo": false, "bAutoWidth": false }); new FixedColumns(oTable1, { "iLeftColumns": 1, "iLeftWidth": 200 }); }); </script>
Table 2 Code:
<script type="text/javascript" src="../../Scripts/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="../../Scripts/DataTables-1.9.4\extras\FixedColumns\media\js\FixedColumns.min.js"></script> <script type="text/javascript" src="../../Scripts/DataTables-1.9.4\media\js\jquery.dataTables.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function () { var oTable = $('#example').dataTable({ "bPaginate": false, "sScrollX": "0", "sScrollY": "200px", "bLengthChange": false, "bFilter": false, "bSort": false, "bInfo": false, "bAutoWidth": false }); new FixedColumns(oTable, { "iLeftColumns": 1, "iLeftWidth": 200 }); }); </script>
Combined View Code:
@if(ViewBag.SearchKey != null) { <div> @Html.Action("PartialView1", "Home", (string)ViewBag.SearchKey) </div> <p style="clear:both; margin-top:4em; font-weight: bold;"> </p> <div> @Html.Action("PartialView2", "Home", (string)ViewBag.SearchKey) </div> }
↧
↧
Fixed Columns and TableTools
First of all, Datatables is AWESOME! :-)
Now the problem. I'm using DataTables 1.9.4, FixedColumns 2.0.3, and as far as I know the latest version of TableTools. I have a table with 2 rows in the <thead> element of the table and the display of the table works great. However, I need to be able to use the TableTools Excel/CSV functionality to get all the data plus both header rows out. The default TableTools doesn't pull both rows so I found this hack:
http://stackoverflow.com/questions/7660683/tabletools-only-exporting-single-header-row
At first it wasn't working but then I disabled the FixedColumn stuff and BAM, works like a dream with the hack in place now.
So now I'm faced with a table that doesn't have fixed columns or a table that doesn't export all the header rows. Is there any way to resolve this? Obviously it's a conflict between TableTools and FixedColumns, but I don't know where to begin fixing it.
The application is behind security so I can't link to it. Here is my header definition with the fixed header stuff commented out:
Now the problem. I'm using DataTables 1.9.4, FixedColumns 2.0.3, and as far as I know the latest version of TableTools. I have a table with 2 rows in the <thead> element of the table and the display of the table works great. However, I need to be able to use the TableTools Excel/CSV functionality to get all the data plus both header rows out. The default TableTools doesn't pull both rows so I found this hack:
http://stackoverflow.com/questions/7660683/tabletools-only-exporting-single-header-row
At first it wasn't working but then I disabled the FixedColumn stuff and BAM, works like a dream with the hack in place now.
So now I'm faced with a table that doesn't have fixed columns or a table that doesn't export all the header rows. Is there any way to resolve this? Obviously it's a conflict between TableTools and FixedColumns, but I don't know where to begin fixing it.
The application is behind security so I can't link to it. Here is my header definition with the fixed header stuff commented out:
<link type="text/css" href="<?=$env?>js/jquery/development-bundle/themes/redmond/jquery.ui.all.css" rel="stylesheet" /> <link type="text/css" href="<?=$env?>js/datatables/media/css/jquery.dataTables.css" rel="stylesheet" /> <link type="text/css" href="<?=$env?>js/datatables/extras/TableTools/media/css/TableTools.css" rel="stylesheet" /> <link type="text/css" href="<?=$env?>js/chozen/chosen/chosen.css" rel="stylesheet" /> <script type="text/javascript" src="<?=$env?>js/jquery/development-bundle/ui/jquery.ui.core.js"></script> <script type="text/javascript" src="<?=$env?>js/jquery/development-bundle/ui/jquery.ui.widget.js"></script> <script type="text/javascript" src="<?=$env?>js/jquery/development-bundle/ui/jquery.ui.datepicker.js"></script> <script type="text/javascript" src="<?=$env?>js/datatables/media/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="<?=$env?>js/datatables/media/js/formatted.numeric.sort.js"></script> <!--<script type="text/javascript" src="<?=$env?>js/datatables/extras/FixedColumns/media/js/FixedColumns.min.js"></script>--> <script type="text/javascript" src="<?=$env?>js/datatables/extras/TableTools/media/js/TableTools.js"></script> <script type="text/javascript" src="<?=$env?>js/datatables/extras/TableTools/media/js/ZeroClipboard.js"></script> <style type="text/css"> .ellip { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .page { margin-top: 50px; } .sorting, .sorting_desc, .sorting_asc { background: none !important; } </style> <script type="text/javascript"> $(function() { var oTable = $('#dtable').dataTable({ "sScrollX": "100%", //"sScrollXInner": "150%", "bScrollCollapse": true, "bPaginate": true, "sPaginationType": "full_numbers", "aaSorting": [[2,'asc'], [3,'asc']], "bStateSave": false, "oLanguage": { "sSearch": "Search all columns:", "sLengthMenu": 'Display <select>'+ '<option value="20">20</option>'+ '<option value="30">30</option>'+ '<option value="40">40</option>'+ '<option value="50">50</option>'+ '<option value="100">100</option>'+ '<option value="-1">All</option>'+ '</select> records' }, "aoColumnDefs": [ { "sClass": "right", "aTargets": [ 10,11,12,13,14,15,16,17,18,19,20,21,22 ] }, { "sType": "formatted-num", "aTargets": [ 10,11,12,13,14,15,16,17,18,19,20,21,22 ] } ], "iDisplayLength": 20, "sDom": 'T<"clear">lfrtip', "oTableTools": { "sSwfPath": "<?=$env?>js/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf" } }); /*new FixedColumns( oTable, { "iLeftColumns": 1 });*/ }); </script>
↧
Applying data table to dynamic table
Dear all
I am trying to applying datatable to dynamic table i.e,, the table is populated with rows when i click a button. The Scroll and fixed header is coming properly but.But when i click on headers the whole data of table will dissapear please help me.
Thanks and Regards
Shashi Kiran M V
I am trying to applying datatable to dynamic table i.e,, the table is populated with rows when i click a button. The Scroll and fixed header is coming properly but.But when i click on headers the whole data of table will dissapear please help me.
Thanks and Regards
Shashi Kiran M V
↧
Problems with ScrollX and ScrollY
Hi Guys,
First of all, wanted to say that we use DataTables on our online system and we love it!
Second, there a page that we use datatables with jeditable, scrollx and scrolly.
The problem is when we use the filter that sometimes returns one record and the horizontal scrollbar covers that record.
Here's the initialization
Any help would be great
First of all, wanted to say that we use DataTables on our online system and we love it!
Second, there a page that we use datatables with jeditable, scrollx and scrolly.
The problem is when we use the filter that sometimes returns one record and the horizontal scrollbar covers that record.
Here's the initialization
var calcDataTableHeight = function() { return $(window).height()*65/100; }; $(document).ready(function(){ console.log(calcDataTableHeight()); oTable = $('#dataTable').dataTable({ "bJQueryUI": true, "sScrollX": "100%", "sScrollXInner": "400%", "sScrollY": calcDataTableHeight(), "bScrollCollapse": true, "bScrollAutoCss": true, "bAutoWidth": false, "bDeferRender": true, "bPaginate": true, "bProcessing": true }); oTable.fnSettings().oScroll.sY = oTable.fnSettings().oScroll.sY +35; $('div.dataTables_scrollBody').css("height", "100%"); $("div.dataTables_scrollHeadInner").css("width","100%"); $("table.dataTable").css("width","100%"); $(".dataTables_filter").css({"float":"right"});
Any help would be great
↧
Trying to sort column with hebrew strings
hi.
i have a problem that i cant resolve and I've been trying for quite a while now
(sorry about my English. its not my mother-tongue)
so here's the thing
i'm trying to add a new sort function to oSort that will sort the Hebrew strings because i couldn't make it sort with the regular built in sort
i'm adding the new sort like this:
and in the datatable settings i added this:
when i click on the header it says that its updating the table but nothing happens
i added console.log inside the functions but it seems that the functions are not being called at all
please help a desperate man :-)
thanks
i have a problem that i cant resolve and I've been trying for quite a while now
(sorry about my English. its not my mother-tongue)
so here's the thing
i'm trying to add a new sort function to oSort that will sort the Hebrew strings because i couldn't make it sort with the regular built in sort
i'm adding the new sort like this:
$.extend( $.fn.dataTableExt.oSort, { "heb-asc": function(x,y) { charstring = '0134567890אבגדהוזחטיכךלמםנןסעפףצץקרשת'; return ((charstring.indexOf(x) < charstring.indexOf(y)) ? -1 : ((charstring.indexOf(x) > charstring.indexOf(y)) ? 1 : 0)); }, "heb-desc": function(x,y) { console.log("ok"); charstring = '0134567890אבגדהוזחטיכךלמםנןסעפףצץקרשת'; return ((charstring.indexOf(x) < charstring.indexOf(y)) ? 1 : ((charstring.indexOf(x) > charstring.indexOf(y)) ? -1 : 0)); } });
and in the datatable settings i added this:
"aoColumns": [ { "sClass": "table_more_details", "bSortable": false }, { "sClass": "delivery_status" }, {"sType": "heb" }, {"sType": "heb" }, {"sType": "heb" }, {"sType": "heb" }, {"sType": "heb" }, null ],
when i click on the header it says that its updating the table but nothing happens
i added console.log inside the functions but it seems that the functions are not being called at all
please help a desperate man :-)
thanks
↧
↧
bStateSave not sending cookie.
Hi everyone.
I'm having a problem with the bStateSave property in DataTables 1.9.
The attribute is enable (true) but when i filter some data and go to another page, when i return the filter isn't there anymore.
Using Chrome, I verified the page information (right-click button) and the cookie wasn't set.
Need support, thank you all.
I'm having a problem with the bStateSave property in DataTables 1.9.
The attribute is enable (true) but when i filter some data and go to another page, when i return the filter isn't there anymore.
$('.example').dataTable({ "bPaginate": true, "bRetrieve": true, "bDestroy": true, "bSortClasses": false, "bStateSave": true, "iCookieDuration": 3600, "sPaginationType": "full_numbers" });
Using Chrome, I verified the page information (right-click button) and the cookie wasn't set.
Need support, thank you all.
↧
Correct way to store the resulting table after filtering.
Hello,
How can i save the table after the filtering is done.
Am using a set of multiple select list as filters. When user filter, the resulting table can be saved so that he can view it later , without using those filters.
How can i do that.
Is there a way to save the filters used to generate the required table and run(trigger the filters) when user wants to access the table directly.
or is there any other way....
Please help.
Regard
Rijz.
How can i save the table after the filtering is done.
Am using a set of multiple select list as filters. When user filter, the resulting table can be saved so that he can view it later , without using those filters.
How can i do that.
Is there a way to save the filters used to generate the required table and run(trigger the filters) when user wants to access the table directly.
or is there any other way....
Please help.
Regard
Rijz.
↧
JSON data from server could not be parsed. JSON formatting error
Hi,
I am using Datatables and server side processing with php connecting to MS SQL Server 2008... its not working because when I try to start up the php page I get: JSON data from server could not be parsed. JSON formatting error. The table headers are there but no rows of data and the "Processing" Div is stuck on the screen. The page looks the same viewed in both IE 9 and Google Chrome 24. I submitted my table to the Datatable debugger and my six digit code is: afubev
Here are some more details of my environment:
jquery 1.8.2
Datatables 1.9.4
TableTools 2.1.5
MS SQL Server 2008 R2
Microsoft SQL Server Management Studio 10.50.4000.0
Microsoft Data Access Components (MDAC) 6.1.7601.17514
Microsoft MSXML 3.0 6.0
Microsoft Internet Explorer 9.0.8112.16421
Microsoft .NET Framework 2.0.50727.5466
Operating System 6.1.7601
IIS Express 8.0
PHP 5.4.12 32-bit Non Thread Safe
Netbeans IDE 7.2.1
IE 9
Google Chrome 24.0
I've googled and tried so many things for hours. In Google Chrome I go into Developer Tools and Network then XHR and click on the Response Tab to view the JSON sent back from the web server. I copy and paste that JSON into JSONLint and it tells me it is valid. I have no idea what could be going wrong, any help greatly appreciated!
This is the php file I use to return a JSON object... I blanked out my DB connection properties. I got this php file from datatables.net...
I am using Datatables and server side processing with php connecting to MS SQL Server 2008... its not working because when I try to start up the php page I get: JSON data from server could not be parsed. JSON formatting error. The table headers are there but no rows of data and the "Processing" Div is stuck on the screen. The page looks the same viewed in both IE 9 and Google Chrome 24. I submitted my table to the Datatable debugger and my six digit code is: afubev
Here are some more details of my environment:
jquery 1.8.2
Datatables 1.9.4
TableTools 2.1.5
MS SQL Server 2008 R2
Microsoft SQL Server Management Studio 10.50.4000.0
Microsoft Data Access Components (MDAC) 6.1.7601.17514
Microsoft MSXML 3.0 6.0
Microsoft Internet Explorer 9.0.8112.16421
Microsoft .NET Framework 2.0.50727.5466
Operating System 6.1.7601
IIS Express 8.0
PHP 5.4.12 32-bit Non Thread Safe
Netbeans IDE 7.2.1
IE 9
Google Chrome 24.0
I've googled and tried so many things for hours. In Google Chrome I go into Developer Tools and Network then XHR and click on the Response Tab to view the JSON sent back from the web server. I copy and paste that JSON into JSONLint and it tells me it is valid. I have no idea what could be going wrong, any help greatly appreciated!
This is the php file I use to return a JSON object... I blanked out my DB connection properties. I got this php file from datatables.net...
<?php /* Indexed column (used for fast and accurate table cardinality) */ $sIndexColumn = "lv.Artikel.OID"; /* DB table to use */ $sTable = "lv.Artikel"; /* Database connection information */ $gaSql['user'] = ""; $gaSql['password'] = ""; $gaSql['db'] = ""; $gaSql['server'] = ""; /* * Columns * If you don't want all of the columns displayed you need to hardcode $aColumns array with your elements. * If not this will grab all the columns associated with $sTable */ $aColumns = array( 'OID', 'Name', 'EAN', 'RundePackung', 'relativeMinimalStock', 'minimalStock' ); /* * Joins. * Replace the $sJoins empty string below with your JOIN clause(s) if you have any. */ //$sJoins = ""; /* * ODBC connection */ $connectionInfo = array("UID" => $gaSql['user'], "PWD" => $gaSql['password'], "Database"=>$gaSql['db'],"ReturnDatesAsStrings"=>true); $gaSql['link'] = sqlsrv_connect( $gaSql['server'], $connectionInfo); if( $gaSql['link'] ) { echo "Connection established.\n"; } else { echo "Connection could not be established.\n"; die( print_r( sqlsrv_errors(), true)); } $params = array(); $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET ); /* * Ordering. * Replace the $sOrder empty string below with your ORDER BY clause if you have one. */ $sOrder = ""; if ( isset( $_GET['iSortCol_0'] ) ) { $sOrder = "ORDER BY "; for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ ) { if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" ) { $sOrder .= $aColumns[ intval( $_GET['iSortCol_'.$i] ) ]." ".addslashes( $_GET['sSortDir_'.$i] ) .", "; } } $sOrder = substr_replace( $sOrder, "", -2 ); if ( $sOrder == "ORDER BY" ) { $sOrder = ""; } } /* * Filtering. * Replace the $sWhere empty string below with your WHERE clause if you have one. */ $sWhere = ""; /* Filter on all columns */ if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" ) { $sWhere = "WHERE ("; for ( $i=0 ; $i<count($aColumns) ; $i++ ) { $sWhere .= $aColumns[$i]." LIKE '%".addslashes( $_GET['sSearch'] )."%' OR "; } $sWhere = substr_replace( $sWhere, "", -3 ); $sWhere .= ')'; } /* Individual column filtering */ for ( $i=0 ; $i<count($aColumns) ; $i++ ) { if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' ) { if ( $sWhere == "" ) { $sWhere = "WHERE "; } else { $sWhere .= " AND "; } $sWhere .= $aColumns[$i]." LIKE '%".addslashes($_GET['sSearch_'.$i])."%' "; } } /* Paging */ /* $top = (isset($_GET['iDisplayStart']))?((int)$_GET['iDisplayStart']):0 ; $limit = (isset($_GET['iDisplayLength']))?((int)$_GET['iDisplayLength'] ):10; $sQuery = "SELECT TOP $limit ".implode(",",$aColumns)." FROM $sTable $sWhere ".(($sWhere=="")?" WHERE ":" AND ")." $sIndexColumn NOT IN ( SELECT $sIndexColumn FROM ( SELECT TOP $top ".implode(",",$aColumns)." FROM $sTable $sWhere $sOrder ) as [virtTable] ) $sOrder"; */ $limit = ""; if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' ) { $limit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ". intval( $_GET['iDisplayLength'] ); } /* * SQL queries * Get data to display */ $sQuery = " SELECT ".implode(",",$aColumns)." FROM $sTable $sWhere $sOrder "; error_log($sQuery); // Execute a Query to get the data from the database $rResult = sqlsrv_query($gaSql['link'],$sQuery) or die("$sQuery: " . sqlsrv_errors()); // Execute a Query to get a count of the number of rows filtered due to a search $sQueryCnt = "SELECT * FROM $sTable $sWhere"; $rResultCnt = sqlsrv_query( $gaSql['link'], $sQueryCnt ,$params, $options) or die (" $sQueryCnt: " . sqlsrv_errors()); $iFilteredTotal = sqlsrv_num_rows( $rResultCnt ); // Execute a Query to get a count of the total number of rows possible (if no filtering was done) $sQuery = " SELECT * FROM $sTable $sWhere"; $rResultTotal = sqlsrv_query( $gaSql['link'], $sQuery ,$params, $options) or die(sqlsrv_errors()); $iTotal = sqlsrv_num_rows( $rResultTotal ); $output = array( "sEcho" => intval($_GET['sEcho']), "iTotalRecords" => $iTotal, "iTotalDisplayRecords" => $iFilteredTotal, "aaData" => array() ); while ( $aRow = sqlsrv_fetch_array( $rResult ) ) { $row = array(); for ( $i=0 ; $i<count($aColumns) ; $i++ ) { if ( $aColumns[$i] != ' ' ) { //$aColumns[$i] = str_replace("%","%%",trim($aColumns[$i])); $v = $aRow[ $aColumns[$i] ]; $v = mb_check_encoding($v, 'UTF-8') ? $v : utf8_encode($v); //$v = str_replace("\/","/",trim($v)); $row[]=trim($v); } } If (!empty($row)) { $output['aaData'][] = $row; } } //error_log( $output["sEcho"] ); //error_log( $output["iTotalRecords"] ); //error_log( $output["iTotalDisplayRecords"] ); echo json_encode( $output ); error_log( json_encode( $output ) ); ?>
↧
Processing Indicator doesn't show up
Hello,
I'm using DataTables 1.9.1, with the Themeroller (headers and footers). I have bProcessing set to true, and have a string for sProcessing, but don't see the Processing indicator show up. Not sure if this shows up only for sorting, but in my case, I have an empty table, and then I load data using fnAddData. I want to display the processing indicator during the time it takes to load those rows. Not sure if sLoadingRecords should work, but I'm guessing not since I don't have "ajax" loaded data. I've also tried explicitly using the fnProcessingIndicator api to show/hide it when I want it, but it still doesn't work. Thinking maybe it's hidden for some reason, I've changed the css for .dataTables_processing to z-index:99999. Still no luck. Please help.
I'm using DataTables 1.9.1, with the Themeroller (headers and footers). I have bProcessing set to true, and have a string for sProcessing, but don't see the Processing indicator show up. Not sure if this shows up only for sorting, but in my case, I have an empty table, and then I load data using fnAddData. I want to display the processing indicator during the time it takes to load those rows. Not sure if sLoadingRecords should work, but I'm guessing not since I don't have "ajax" loaded data. I've also tried explicitly using the fnProcessingIndicator api to show/hide it when I want it, but it still doesn't work. Thinking maybe it's hidden for some reason, I've changed the css for .dataTables_processing to z-index:99999. Still no luck. Please help.
↧
↧
Using Same mData Multiple Times with fnRender
Version: DataTables 1.9.4
I want to use same "oObj.aData.id_company" in multiple columns but it can't render it. It's all OK if I use it only one time as in second code block below:
I am doing wrong or missing something?
Here is the code for debug: http://debug.datatables.net/unocid
I want to use same "oObj.aData.id_company" in multiple columns but it can't render it. It's all OK if I use it only one time as in second code block below:
var col_def = [ { "mData": "id_company", "sTitle":"Edit","fnRender" : function (oObj){ return '<a href="'+BaseURL+oObj.aData.id_company+'">Edit</a>'; } }, { "mData": "company_name", "sTitle":"Company Name", "sWidth":"50%"}, { "mData": "id_company", "sTitle":"Delete","fnRender" : function (oObj){ return '<a href="'+BaseURL+oObj.aData.id_company+'">Delete</a>'; } } ];
var col_def = [ { "mData": "company_name", "sTitle":"Company Name", "sWidth":"50%"}, { "mData": "id_company", "sTitle":"Delete","fnRender" : function (oObj){ return '<a href="'+BaseURL+oObj.aData.id_company+'">Delete</a>'; } } ];
I am doing wrong or missing something?
Here is the code for debug: http://debug.datatables.net/unocid
↧
How to export img in CSV file in data table
I have images in one column on my datatable that represent certain business logic.For ex : red dot might indicate the record is due in 2 days,pink dot indicates that rec is due in 10 days and so on .
Export to csv doesn't pull the img.
Is it possible to include img in csv,if not is it possible to replace img with text during export.
Am new to datables, the question might have been answered previously but couldn't find answer.
I apprecite your help on this.
Thx
Acqerie
Export to csv doesn't pull the img.
Is it possible to include img in csv,if not is it possible to replace img with text during export.
Am new to datables, the question might have been answered previously but couldn't find answer.
I apprecite your help on this.
Thx
Acqerie
↧
Resizing Table Causes oFeatures is null or not an object
I have an HTML table on my page created using JSTL. I use jQuery.load and div tags. The following is included:
When the page is first loaded it appears and resizes fine, all the columns line up. However, if I reload the page I get the js error: oFeatures is null or not an Object Line 227. At this point the header on longer resizes with the body columns. If I reload the page again the columns will line up normally but if resized the header columns stay static.
<script type="text/javascript"> $(document).ready(function(){ var oTableV5 = $('#rtQueueBody').dataTable({ "bPaginate": false, "bSort": false, "bFilter": false, "sScrollY": "500px" }); $(window).resize(function() { oTableV5.fnAdjustColumnSizing(); }); }); </script>
When the page is first loaded it appears and resizes fine, all the columns line up. However, if I reload the page I get the js error: oFeatures is null or not an Object Line 227. At this point the header on longer resizes with the body columns. If I reload the page again the columns will line up normally but if resized the header columns stay static.
↧