Xataface 3.0.3 not sorting table in DESC order, but worked in 2.1.3

39 views
Skip to first unread message

David Scott

unread,
Dec 5, 2024, 12:57:35 PM12/5/24
to Xataface
Hi Steve,

I am trying to migrate from 2.1.3 to 3.0.3 and ran into a little problem.  In one of my fields.ini files I had the following SQL statement at the beginning of the file:

__sql__="SELECT i.*, j.DocumentTitle AS Description FROM tbl_DocActivities i LEFT JOIN tbl_PartNumbers j ON i.Document_Control_Number=j.DocumentControlNumber ORDER BY CONumber DESC"

This worked as expected in 2.1.3 in that it pulled the correct records, ordered all of the records by CONumber and displayed the table in descending order by CONumber.  For some reason this is not working in 3.0.3.  It still groups the records properly but it displays in CONumber in ascending order.  In both cases, I am using the G2 theme.

Any ideas?

Hope all is well,

-Dave

David Scott

unread,
Dec 11, 2024, 6:04:51 PM12/11/24
to Xataface
Steve,

I tried adding the grafted field expression in the delegated class.  This is a different table but it has the same problem.  ORDER BY section seems to be ignored.

<?php
class tables_tbl_RMInv {

function __sql__(){
return "SELECT o.ID, o.Part, o.Price, o.Reorder, o.Leadtimes_weeks, o.Vendors, SUM(i.Qnty) AS Qnty, j.DocumentTitle AS Description FROM tbl_RMInv o LEFT JOIN tbl_RMQnty i ON o.ID=i.RM_ID LEFT JOIN tbl_PartNumbers j ON o.Part=j.DocumentControlNumber GROUP BY o.ID, o.Part ORDER BY o.Part";
    }
}

?>

David Scott

unread,
Dec 12, 2024, 9:11:08 PM12/12/24
to Xataface
Ok, I finally found the solution.

After the __sql__ statement, I added the following line:

table.default_sort=CONumber desc

--> Fixed.
Reply all
Reply to author
Forward
0 new messages