Adding Arrows for Dynamic Sorting

  • Last update:March 08, 2024
  • Overview 

    Expected Effect 

    In a scenario where you can sort data dynamically by clicking the table header, you may want to add arrows to the table header to indicate the current sort basis and the sort rule (ascend or descend). The expected effect is shown in the following figure.

    Screen Recording 2024-03-08 at 11.40.19.gif

    Implementation Method 

    Use Condition Attribute together with HTML tags.

    Example 

    Template Preparation 

    This document uses a template made in Multi-column Dynamic Sort for illustration.

    You can download the template. 

    Adding Condition Attributes 

    Add three condition attributes to all cells with table headers, and name them Unsort, Ascend, and Descend. Set Attribute to New Value, select F(x), enter the following formula, and set Type to Formula.

    iconNote:
    You can select cells A2 to D2 simultaneously, add condition attributes, and modify details separately

    • Unsort

    CellNew Value FormulaFormula Condition
    A2"<font color='gray'>↑↓ </font>" + $$$$asc<>"A3"
    B2$asc<>"B3"
    C2$asc<>"C3"
    D2$asc<>"D3"
    • Ascend

    CellNew Value FormulaFormula Condition
    A2"↑<font color='gray'>↓ </font>" + $$$$asc="A3"&&$a=1
    B2$asc="B3"&&$a=1
    C2$asc="C3"&&$a=1
    D2$asc="D3"&&$a=1
    • Descend

    CellNew Value FormulaFormula Condition
    A2"<font color='gray'>↑</font>↓ " + $$$$asc="A3"&&$a<>1
    B2$asc="B3"&&$a<>1
    C2$asc="C3"&&$a<>1
    D2$asc="D3"&&$a<>1

    The steps are shown in the following figure.

    Setting Cells to Display by HTML 

    Select cells A2 to D2, choose Cell Attributes > Others, and set Display Content to Display by HTML

    Effect Display 

    On PC

    Save the template and click Pagination Preview. You can see that the effect is the same as section "Expected Effect."

    On Mobile Terminals

    The template can be previewed on both the DataAnalyst and HTML5 apps. The effect is shown in the following figure.

    673_1709869361.gif

    Template Download 

    You can download the example template. Add arrows for dynamic sorting .cpt


    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy