Search
11152 results 7351-7360
Forum
- 6th Mar 2009Configurations Difficulties - Initial Sorting, Pagination, Searchingthe tables to be sorted initially as they are
- 21st Nov 2024Datetime column not sorting correctlyLink to test case: https://www.wd4g.com/WCGateway/DTDemoCase1.wc Debugger code (debug.datatables.net): n\a Error messages shown: n\a Description of problem: See below Hi, this is my first attempt at having a datetime column, so I'm probably missing something obvious, but I've searched the forums and implemented the suggestions I found, but it is not quite right. The column searches correctly on the date but the times are not right, it should be the most recent at the top, this is the code I have added, so far: Before the DT init section I added: $.fn.dataTable.moment('DD/MM/YYYY'); \\ This already existed and is needed for simple date fields $.fn.dataTable.moment('DD/MM/YYYY HH:MM:SS A'); \\ This I added for the new datetime fields In the column definition section I added: { targets: [0], type: "moment-DD/MM/YYYY HH:MM:SS A"}, If someone could please take a look and advise that would be greatly appreciated. Thanks, Chris
- 30th Apr 2024rowReorder and save the new sorting order in mysql tableHi Kevin, Finally it works. Thanks for helping me! :smiley: dataSrc must be set to 'order_id' and not to the auto_increment 'id' otherwise you will continue to get duplicate order_ids. I dropped the UNIQUE constraint off again. And when creating a new category the 'order_id' must find the last 'order_id' and do a +1 Complete code below: var table = new DataTable('#categoriesTable', { dom: "Bfrtilp", buttons: ["excel", "pdf"], processing: true, serverSide: true, serverMethod: 'post', rowReorder: { selector: '.reorder', dataSrc: 'order_id' }, ajax: { url: 'assets/ajax/ajax-get-table-games-cats-overview.php' }, //scrollX: !0, columns: [ { data: 'id' }, { data: 'test' }, { data: 'cat_name' }, { data: 'cat_icon' }, { data: 'active' }, { data: 'order_id' }, { data: 'actions' } ], columnDefs: [ { className: 'reorder', render: () => '≡', targets: 1, orderable: false }, { targets: [3,4,5,6], class: 'text-center' }, { targets: [3,6], orderable: false } ], order: [[5, "asc"]] }); table.on('row-reorder', function (e, diff, edit) { var update = []; for (var i = 0, ien = diff.length; i < ien; i++) { let rowData = table.row(diff[i].node).data(); update.push( {id: rowData.id, order_id: diff[i].newData} ); } //console.log(update); $.ajax({ type: 'POST', url: 'assets/ajax/ajax-content-games-categories-change-order.php', dataType: 'json', cache: false, data: {update: update}, success: function (data) { $('#categoriesTable').DataTable().ajax.reload( null, false ); }, error: function (data) { console.log('An error occurred'); console.log(data); } }); }); ajax-content-games-categories-change-order.php file contains: $update = $_REQUEST['update']; foreach($update as $u) { $data = array( 'order_id' => $u['order_id'] ); $db->where('id', $u['id']); $db->update('game_categories', $data); }
- 10th May 2023Why is datatables returing all data from database table yet I have used serverside sorting beforeI would start by posting your serverside code so we can take a look at what you have. fails to work. Please provide more specifics of how it doesn't work. Do you see error messages? Kevin
- 29th Jan 2023Sorting in Each column Not workingIts not a simple fix and would take some time. My suggestion is to look at making it an object where the key is the column index and the value is an object containing the search type and value. In the search plugin loop through the object using the key to get the column data for the evaluation. Similar to the checkbox example I linked to. Kevin
- 24th Dec 2022duaggable sorting not work because of newData,oldData is undefinedWe're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here. Cheers, Colin
- 11th Oct 2022Sorting arrows in column headerHi, Probably a UTF8 error somewhere. Can you give me a link to your page and I'll take a look. Thanks, Allan
- 6th Oct 2022jQuery Datatable server side pagination and sorting in Blazor applicationhttps://datatables.net/forums/discussion/60598/working-with-datatable-and-blazor-server-side#latest
- 13th Apr 2022Date format not sorting and searchingUse the solution presented in this blog. Kevin
- 6th Apr 2022How can I hide some rows after sorting a column?is the one being sorted on, and if so,