Improper Table Sorting on References

Column sorting does not work as expected on reference columns. Clicking on the sort function a second time does not lead to a change in sorting order. Inspection of the model shows that the initial order by element is appended to the orderbyclause as many times as the sort action is clicked.

ex.: orderByClause:“Product.Name ASC NULLS LAST,Product.Name ASC NULLS LAST,Product.Name ASC NULLS LAST,ClosedDate DESC”

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="Cases" limit="2000" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Case" orderby="ClosedDate DESC">
            <fields>
                <field id="RecordTypeId"/>
                <field id="Id"/>
                <field id="Subject"/>
                <field id="CreatedDate"/>
                <field id="ClosedDate"/>
                <field id="ProductId"/>
                <field id="Product.Name"/>
            </fields>
            <conditions>
                <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="ProductId" fieldtargetobjects="Product2" state="filterableoff" inactive="true" name="ProductId"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" alwaysresetpagination="false" createrecords="false" model="Cases" buttonposition="" mode="readonly" allowcolumnreordering="false" responsive="false" uniqueid="sk-3_NPqR-393">
            <fields>
                <field id="Id" hideable="false" uniqueid="fi-3_NVNe-410" valuehalign="" type="" showbydefault="true"/>
                <field id="Subject" hideable="false" uniqueid="fi-3_NVNe-411" valuehalign="" type="" showbydefault="true"/>
                <field id="CreatedDate" hideable="false" uniqueid="fi-3_NVNe-412" valuehalign="" type="" showbydefault="true"/>
                <field id="ClosedDate" hideable="false" uniqueid="fi-3_NVNe-413" valuehalign="" type="" showbydefault="true"/>
                <field id="ProductId" hideable="false" uniqueid="fi-3_NVNe-414" valuehalign="" type="" showbydefault="true" allowordering="true"/>
            </fields>
            <rowactions/>
            <massactions usefirstitemasdefault="true"/>
            <views>
                <view type="standard"/>
            </views>
        </skootable>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-3_NApN-245"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>

What version of Skuid are you on?

Because of a difference of permissions, I had to create a different page to work with. Do you see the error on this page when sorting the Account Reference? I find it works on second, third, and beyond clicks.

        <field id="ContactId"/>
        </conditions>
        <actions/>
    </model>
</models>
<components>
    <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" alwaysresetpagination="false" createrecords="false" model="Cases" buttonposition="" mode="readonly" allowcolumnreordering="false" responsive="false" uniqueid="sk-3_NPqR-393">
        <fields>
        </fields>
        <rowactions/>
        <massactions usefirstitemasdefault="true"/>
        <views>
            <view type="standard"/>
        </views>
    </skootable>
</components>
<resources>
    <labels/>
    <javascript/>
    <css/>
    <actionsequences uniqueid="sk-3_NApN-245"/>
</resources>
<styles>
    <styleitem type="background" bgtype="none"/>
</styles>

11.0.2


Unfortunately, using your XML I am seeing the same malformation of the query - I’m on 11.0.2.

This is the change sequence by pressing the downward arrow over and over again. It would be similar but reverse if pressing the upward arrow:

On page load:
orderByClause:“Account.Name DESC NULLS LAST,ClosedDate DESC”
After First pressing:
orderByClause:“ClosedDate DESC”
After Second pressing:
orderByClause:“Account.Name ASC NULLS LAST,ClosedDate DESC”
After Third pressing:
orderByClause:“Account.Name DESC NULLS LAST,ClosedDate DESC”
After Fourth pressing:
orderByClause:“ClosedDate DESC”
Repeat

This is expected behavior. Why are you thinking it’s incorrect? Are the arrows not working for you in some way? I’m not following on how this table sorting is improper

This occurs whether I am clicking on the up or down button. Furthermore, if the table is already sorting descending, if I click the down button it should remove the descending sort - not add additional descending sorts on the same field.

Once the sorting has taken place, there is no randomization that takes place. Press descending once, it’ll descend. Press it again, it’ll remain ascend. There isn’t a way for us to “remove the descending”. That would more or less be to just randomize the results. We don’t store the data of what the order was before it was sorted. What you’re describing is expected behavior in Skuid