SP-54: Fix sort direction
This commit is contained in:
1 parent
f3546d79b1
commit
ffce497e3f
3 files changed
+9
-7
No files matched your search
@@ -351,12 +351,11 @@ let update msg (model:Reports.Types.Model) : Model * Cmd<Msg> =
|
||||
match pnlSorting with
|
||||
| None -> model.PnLSortDirection
|
||||
| Some record ->
|
||||
let srt = (decodeUint8<string * bool> record.value)
|
||||
(fst srt, not <| snd srt)
|
||||
(decodeUint8<string * bool> record.value)
|
||||
|
||||
{ model with PnLColumns = newCols; PnLFilterValues = newFilterValues; PnLSortDirection = newSorting },
|
||||
Cmd.batch (
|
||||
(Cmd.ofMsg (SetPnLSort <| fst newSorting ))::[ for f in newFilterValues do yield Cmd.ofMsg (SetPnLFilter (f.Key, f.Value))])
|
||||
(Cmd.ofMsg (SetPnLSort <| newSorting ))::[ for f in newFilterValues do yield Cmd.ofMsg (SetPnLFilter (f.Key, f.Value))])
|
||||
| _ ->
|
||||
model, Cmd.Empty
|
||||
| RpcResponse str ->
|
||||
@@ -396,7 +395,7 @@ let update msg (model:Reports.Types.Model) : Model * Cmd<Msg> =
|
||||
{ model with mdRelayExpNameData = data; securityList = secs |> Map.ofList },
|
||||
Cmd.batch (
|
||||
selectSub None model ::
|
||||
(Cmd.ofMsg (SetPnLSort <| fst model.PnLSortDirection ))::
|
||||
(Cmd.ofMsg (SetPnLSort <| model.PnLSortDirection ))::
|
||||
[ for f in model.PnLFilterValues do yield Cmd.ofMsg (SetPnLFilter (f.Key, f.Value))])
|
||||
| UpdateProducts data ->
|
||||
{ model with mdRelayProductData = data}, Cmd.ofExistingPromise (requestExpNames model.mdRelay) id (box>>ErrorOccured)
|
||||
@@ -475,8 +474,10 @@ let update msg (model:Reports.Types.Model) : Model * Cmd<Msg> =
|
||||
| true -> model, Cmd.ofMsg (SetPnLFilter (header, Empty))
|
||||
| false -> model, Cmd.Empty
|
||||
|
||||
| SetPnLSort header ->
|
||||
| SwitchPnLSort header ->
|
||||
let direction = fst <| model.PnLSortDirection <> header || not <| snd model.PnLSortDirection
|
||||
model, Cmd.ofMsg <| SetPnLSort (header, direction)
|
||||
| SetPnLSort (header, direction) ->
|
||||
let gSec = getSec <| model.securityList << uint32
|
||||
|
||||
let compStr (str1, str2) =
|
||||
|
||||
@@ -43,7 +43,8 @@ type Msg =
|
||||
| UpdateProducts of Product[]
|
||||
| ChangePnLColumnVisibility of string * bool
|
||||
| SetPnLColumns of (string * bool) List
|
||||
| SetPnLSort of string
|
||||
| SwitchPnLSort of string
|
||||
| SetPnLSort of string * bool
|
||||
| SetPnLTempFilter of string * ColFilter
|
||||
| SetPnLFilter of string * ColFilter
|
||||
| ClearPnLFilter of string
|
||||
|
||||
@@ -103,7 +103,7 @@ let PnLTabView (model:Model) (dispatch:Msg->Unit) =
|
||||
if visible then
|
||||
yield ( TableControl.Cell
|
||||
( div [ ClassName "table-header" ] [
|
||||
span [ OnClick (fun _ -> header |> SetPnLSort |> dispatch)] [str <| sprintf "%s " header]
|
||||
span [ OnClick (fun _ -> header |> SwitchPnLSort |> dispatch)] [str <| sprintf "%s " header]
|
||||
sortIcon header visible
|
||||
filterIcon header
|
||||
])
|
||||
|
||||
Reference in new issue
Block a user