The same code produce different results from phpmyadmin vs wpdatatable.
My intention is to put the NULL values at the end, after sort ascending. I appears the results from phpadmin are correct. In wpdatatable, the NULL vaules are still at the beginning of the table.
Please take a look at the screenshots.
/* civil */
select `2021Ranking` AS `2021排名`,
table1.cname AS `大学中文名`,
table1.name AS `大学英文名`,
table2.major_ranking AS `专业排名`
from table1, table2
where table1.University_ID = table2.University_ID
order by ISNULL(`2021Ranking`), `2021Ranking` asc;
Please note some this when working with the server-side processing feature:
Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine, so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of the statement automatically when users trigger the sorting on the front-end, and having it in the initial statement may cause the table to crash.
So, when you create the table you can access column settings, and under Sorting tab make sure this column is used for sorting by default, and then set up so it's either Ascending or descending.
"So, when you create the table you can access column settings, and under Sorting tab make sure this column is used for sorting by default, and then set up so it's either Ascending or descending."
No Problem, I could do that.
But how do you put NULL values at the last, when other values of this column is numbers?
I played with SELECT statements for a reason, the Sorting tab can't cover everything.
NULL values are not valid entries for numerical columns, so the plugin can have issues with sorting of these values. Numerical columns need to have a number in them by default.
You can try adding the SQL query you initially used to create a MySQL view. Then, if you pull that view from the database, it may use the ORDER BY function, but I can't promise that.
Dear Support,
The same code produce different results from phpmyadmin vs wpdatatable.
My intention is to put the NULL values at the end, after sort ascending. I appears the results from phpadmin are correct. In wpdatatable, the NULL vaules are still at the beginning of the table.
Please take a look at the screenshots.
Hello fangquans
Please note some this when working with the server-side processing feature:
So, when you create the table you can access column settings, and under Sorting tab make sure this column is used for sorting by default, and then set up so it's either Ascending or descending.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
HI Aleksandar,
"So, when you create the table you can access column settings, and under Sorting tab make sure this column is used for sorting by default, and then set up so it's either Ascending or descending."
No Problem, I could do that.
But how do you put NULL values at the last, when other values of this column is numbers?
I played with SELECT statements for a reason, the Sorting tab can't cover everything.
Hello again.
NULL values are not valid entries for numerical columns, so the plugin can have issues with sorting of these values. Numerical columns need to have a number in them by default.
You can try adding the SQL query you initially used to create a MySQL view. Then, if you pull that view from the database, it may use the ORDER BY function, but I can't promise that.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables