Comments (2)
Actually, it is the expected behaviour of the library. That's how sorting works.
If you want to keep sorting as it is on init, you should leave a blank array to "order" settings of datatables in javascript.
"order": []
I think it is the best way to set a default sorting order is setting "order" variable in javascript, and remove "order by" statements from sql, so php library can add the statement accordingly.
$(document).ready(function() {
$('#example').dataTable( {
"serverSide": true,
"ajax" : "/public/ajax.php",
"order" : [
[1, "asc"],
[2, "desc"]
]
});
});
from datatables.
Thank you!, it seem I missed the "order" part and "aaSorting" part, what I expect is the library will do the ordering part for init, but the js configuration mess it up, I will close the issue now thanks!
from datatables.
Related Issues (20)
- Large Table Count HOT 2
- Mysql table with dashes in name causes error HOT 15
- Filters HOT 3
- Support Mutiple schema with Postgresql HOT 4
- Which method adds optional parameters to the row? HOT 1
- Add support for Embedded DataTable from Editor HOT 1
- Conditional where clauses for PhalconAdapter HOT 1
- MySQL error on special column names HOT 5
- addIndexColumn / DT_RowIndex
- Laravel adapter does not work with PostgreSQL
- PhalconAdapter not working
- Export to Excel feature HOT 1
- datatable: data with function, doesn't work sort HOT 1
- Problem when using sql server in codeigniter 4 adapter HOT 2
- data as array are forbidden HOT 1
- Skip Total Records HOT 2
- edit all columns HOT 5
- weird error with the sorting of multiple columns HOT 1
- Mysql PDO HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatables.