Search
18504 results 2901-2910
Forum
- 8th Feb 2016How to reload datatable with ajax as a source when the input is "cleared"So right now I have this code snippet that fires the search when more than 3 characters are pressed: $(".filter").on("keyup change", function () { //clear global search values if(this.value.length >= 3) { // Call the API search function vendorListTable.search(""); vendorListTable.column($(this).data('columnIndex')).search(this.value).draw(); } // Ensure we clear the search if they backspace far enough if(this.value == "") { vendorListTable.search(""); vendorListTable.search("").draw(); } }); However, when I clear the field either by pressing backspace or cutting the value datatables won't reload. Any ideas as to how this is achieved?
- 22nd Jan 2016datatables without AJAX load only displayed pageHi, I want to use dataTables w/out AJAX.I do it.Unfortunately i have product groups with about 3000 records.The page loads about 5 seconds which is bad.My questions is - is there any way to load only the data for the selected page in order to not load slow.If we click on 4page, to reload the entire page with the content for 4.
- 16th Jan 2016Jquery function is not working when show table from ajax request page$(function () { $("#example1").DataTable(); $('#example2').DataTable({ "paging": true, "lengthChange": true, "searching": true, "ordering": true, "info": true, "autoWidth": false }); });
- 28th Sep 20152 Datatables Ajax source how toHi, I am doing 2 datatables in one page, separated. In first table I have contract directions of one client. And in second table I have the equipment included in the contract. When I select one direction in first table the second table reloads and shows only the equipment of this direction, but I cant do this. The request goes, but parametres not, and returns null array. Any suggestion?? Anyone does it?? Thanks
- 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.