Search
18367 results 2891-2900
Forum
- 25th Sep 2015How to export csv all row in datatables using ajax source and serverside true ?I'm using code igniter for my datatables. if using print on menu tabletoools, datatables can export all row but on csv or excel only page 1. why ? thanks. This my controler : public function tabel_log() { $aColumns = array('tanggal', 'nama', 'ip','type','gadget'); $sTable = 'log'; $iDisplayStart = $this->input->get_post('iDisplayStart', true); $iDisplayLength = $this->input->get_post('iDisplayLength', true); $iSortCol_0 = $this->input->get_post('iSortCol_0', true); $iSortingCols = $this->input->get_post('iSortingCols', true); $sSearch = $this->input->get_post('sSearch', true); $sEcho = $this->input->get_post('sEcho', true); // Paging if(isset($iDisplayStart) && $iDisplayLength != '-1') { $this->db->limit($this->db->escape_str($iDisplayLength), $this->db->escape_str($iDisplayStart)); } // Ordering if(isset($iSortCol_0)) { for($i=0; $i<intval($iSortingCols); $i++) { $iSortCol = $this->input->get_post('iSortCol_'.$i, true); $bSortable = $this->input->get_post('bSortable_'.intval($iSortCol), true); $sSortDir = $this->input->get_post('sSortDir_'.$i, true); if($bSortable == 'true') { $this->db->order_by($aColumns[intval($this->db->escape_str($iSortCol))], $this->db->escape_str($sSortDir)); } } } if(isset($sSearch) && !empty($sSearch)) { for($i=0; $i<count($aColumns); $i++) { $bSearchable = $this->input->get_post('bSearchable_'.$i, true); // Individual column filtering if(isset($bSearchable) && $bSearchable == 'true') { $this->db->or_like($aColumns[$i], $this->db->escape_like_str($sSearch)); } } } // Select Data $this->db->select('SQL_CALC_FOUND_ROWS '.str_replace(' , ', ' ', implode(', ', $aColumns)), false); $rResult = $this->db->get($sTable); // Data set length after filtering $this->db->select('FOUND_ROWS() AS found_rows'); $iFilteredTotal = $this->db->get()->row()->found_rows; // Total data set length $iTotal = $this->db->count_all($sTable); // Output $output = array( 'sEcho' => intval($sEcho), 'iTotalRecords' => $iTotal, 'iTotalDisplayRecords' => $iFilteredTotal, 'aaData' => array() ); foreach($rResult->result_array() as $aRow) { $row = array(); foreach($aColumns as $col) { $row[] = $aRow[$col]; } $output['aaData'][] = $row; } echo json_encode($output); } This my View : var datatables = $('#table_log').dataTable( { "bJQueryUI": true, "bProcessing": true, "bServerSide": true, "bDeferRender": true, "sServerMethod": "GET", "sPaginationType": "full_numbers", "order": [[ 0, "desc" ]], "iDisplayLength" : 8, "sAjaxSource": "index.php/con_datatables/tabel_log", "aoColumns": [ { "title": "Tanggal","sWidth": "25%","aadata": "tanggal" }, { "title": "Nama","sWidth": "15%","type": "natural","aadata": "nama" }, { "title": "IP","sWidth": "20%","aadata": "ip" }, { "title": "Type","sWidth": "20%","aadata": "type" }, { "title": "Use","sWidth": "20%","aadata": "gadget" } ], "sDom": '<"H"Tlfr>t<"F"ip>', "oTableTools": { "sRowSelect": "os", "sSwfPath": "/js/copy_csv_xls_pdf.swf", "aButtons": [ { "sExtends": "copy", "oSelectorOpts": { filter: 'applied', order: 'current' } }, { "sExtends": "csv", "oSelectorOpts": { filter: 'applied', order: 'current' }, "sFileName": ".csv" }, { "sExtends": "xls", "oSelectorOpts": { filter: 'applied', order: 'current' }, "sFileName": ".xls" }, { "sExtends": "pdf", "oSelectorOpts": { filter: 'applied', order: 'current' }, "sFileName": "*.pdf" }, { "sExtends": "print", "oSelectorOpts": { filter: 'applied', order: 'current' } } ] } } );
- 1st Aug 2015follow on to this post - bootstrap modal + ajaxHi, this discussion looks helpful to me, but is now closed: https://datatables.net/forums/discussion/11242/can-datatables-be-integrated-into-a-table-in-a-bootstrap-modal I'm afraid I don't understand what " Just initialise the DataTable after you write the HTML." means. A code example would be great! Thanks!
- 15th Jun 2015Edit submitted data before saving using editor and ajax asp.netHello I have been playing around with Datatables Editor today, and have mostly managed to customize it to my needs. However, I need to access the submitted data (Add and edit) on the server, before saving to the database. For example adding values from two fields. How can this be done? Public Class InvoiceLineController Inherits ApiController Private db As New DataContext <Route("api/InvoiceLine")> _ _ _ Public Function InvoiceLine(ByVal id As String) As IHttpActionResult Dim request = HttpContext.Current.Request Dim conn As DbConnection = db.Database.Connection() Using db = New DataTables.Database("sqlserver", conn) Dim response = New Editor(db, "InvoiceLine", "InvoiceLineId") _ .Model(Of InvoiceLine)() _ .Field(New Field("InvoiceId").Validator(Validation.NotEmpty())) _ .Field(New Field("Quantity").Validator(Validation.Numeric())) _ .Field(New Field("SalePrice").Validator(Validation.Numeric())) _ .Field(New Field("Discount").Validator(Validation.Numeric())) _ .Field(New Field("Total").Set(Field.SetType.Both).SetValue("Value calculated from the above fields here")) _ .Where("InvoiceId", id) _ .Process(request) _ .Data() Return Json(response) End Using End Function End Class
- 12th Jun 2015put ajax data inside an input in DataTable row.I want to get the data from the database and put them inside the jquery datatable, but not as normal html table, but inside input fields. There's a question like this in stack overflow with more details and with a screenshot how i want the output. http://stackoverflow.com/questions/30799914/jquery-datatable-put-data-from-the-database-into-an-input-element/30800230#30800230
- 14th May 2015Correct options for getting custom JSON with AJAXAs a lot of others, I have problems getting my Datatables to use my custom JSON. Though, I can't really seem to find anything about which parameters one have to use, or how to actually find out what Datatables is trying to do with my data. So I have a pretty standard REST API returning data in a JSON format, which I then spit into Datatables. It looks like this: http://pastebin.com/fn7L1KTj Though, Datatables just gives me Uncaught TypeError: Cannot read property 'length' of undefined at for ( i=0 ; i<aData.length ; i++ ) { in the function called _fnBuildAjax. Is there any standard options I should use to get this running, or do I have to do some custom formatting in the initialization of Datatables too?
- 22nd Apr 2015jQuery DataTables Scroller Ajax not being called the second timeI've posted a question in stackoverflow, can someone help me get an answer: http://stackoverflow.com/questions/29804178/jquery-datatables-scroller-ajax-not-being-called-the-second-time Thanks in advane.
- 16th Apr 2015Search ajaxHello, I saw a posting in the comments, but for me it did not work (http://www.datatables.net/examples/api/multi_filter.html). Someone answering me a question? The it was made I have sent several requests to my server. It is possible to only send a request with all que any fields are filled? I Was Unable to it in Place. I'm using version 1.10.
- 13th Apr 2015reload ajax url, when upload a file with dropzonei have a page that load the files uploaded, but i want to reload the table when a file is uploaded via my dropzone div, the dropzone provide a on sucess, so i will paste the code in this part.
- 8th Apr 2015Table duplicate above existing one when serverside ajax reloadi created table with server side responce but when i reload using table. table.fnDraw(); table.ajax.url(); table.ajax.reload(); I called any one from above table duplicate above exiting one? My table debug report: http://debug.datatables.net/izivoj http://i.stack.imgur.com/iXYoj.png
- 19th Mar 2015checkboxes in rows from ajax{}i cant find a way to put a checkbox into my table, last thing i tried columns: [ { data: "active", render: function ( data, type, row ) { if ( type === 'display' ) { return ''; } return data; }, className: "dt-body-center" } ],