SmartTableSortKey.h

What a column hands the sort. A number sorts as a number, not as its text.

Source/SmartTables/Public/SmartTableSortKey.h

The value of one cell, cut down to something that can be put in order.

Numeric is about being right and not about being quick. Compared as text, 1.25 and 1.5 read as the digit runs 25 and 5, and come out the wrong way round. A column takes its kind from the type of the member it binds and never from what its cell draws.

No UObject, no FText, no delegate. An array of these sorts on a worker thread.

Struct
FSmartTableSortKey
Members
12

Public functions 6

MakeEmptystatic
static FSmartTableSortKey MakeEmpty()
MakeNumberstatic
static FSmartTableSortKey MakeNumber( double InNumber )
MakeBoolstatic
static FSmartTableSortKey MakeBool( bool bInValue )

A number, one or zero. One click sorts ascending, and zero leads, so false rows come first.

MakeTextstatic
static FSmartTableSortKey MakeText( const FString & InText )
IsEmpty
bool IsEmpty() const
Compare
int32 Compare( const FSmartTableSortKey & Other ) const

Gives back -1, 0 or 1. Which way a level is sorted, and where an empty key goes, both belong to the sort and cannot be read off from here.

Two kinds in one column are ORDERED by kind, in the order the kinds are declared: empty first, then every number, then every string. A tie there would be no order at all: call them equal and 5 == "a", "a" == 3, yet 5 > 3. The rows then land in whatever order the pairs happened to give.

A model reaches this with no bug of its own. Bindings resolve per item class, and Score as a float on one class with a string on another is two kinds in one column.

Public variables 3

KindKindpanel
UPROPERTY( BlueprintReadWrite, Category = "Smart Tables" ) ESmartTableSortKeyKind Kind = ESmartTableSortKeyKind::Empty

Which of the two fields below means anything. Empty means neither.

NumberNumberpanel
UPROPERTY( BlueprintReadWrite, Category = "Smart Tables" ) double Number = 0.0

Read only while Kind is Numeric.

TextTextpanel
UPROPERTY( BlueprintReadWrite, Category = "Smart Tables" ) FString Text

Read only while Kind is String. Compared without case, with runs of digits read as numbers.

An FString and never an FText. A sort compares one column across every row, and comparing two FText values costs far more than comparing two pieces of plain text.

ESmartTableSortKeyKind enum

What a sort key holds, which decides how two of them are compared.

Values 3

EmptyEmpty
Empty

No answer in this column. SortIndices places these last whichever way a level is sorted, and never asks Compare about one.

NumericNumeric
Numeric

Compared as a number. A true or false value comes through here as one or zero.

StringString
String

Text, compared without case and with digit runs read as numbers.

Next: SmartTableCellDragDropOp.h