Successfully!

Error!

Adding Arrows for Dynamic Sorting

  • Last update:  2024-03-08
  • 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
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback