DataSource: Find() method now takes the ascending / descending sort order into account.
[GB.DB.FORM] * BUG: DataSource: Find() method now takes the ascending / descending sort order into account. * BUG: DataView: The MoveTo() method raises the Activate event when it was in creation mode before moving. * NEW: DataView: MovePrevious() moves to the last record if we are in creation mode. * NEW: DataView: MoveNext() has no effect if we are in creation mode.
This commit is contained in:
parent
9c1e73a912
commit
10db065201
2 changed files with 5 additions and 14 deletions
|
@ -167,17 +167,10 @@ End
|
|||
Public Sub Find(sWhere As String, Optional iFrom As Integer) As Integer
|
||||
|
||||
Dim sReq As String
|
||||
Dim aSort As String[]
|
||||
Dim I As Integer
|
||||
Dim sSelect As String
|
||||
Dim rFind As Result
|
||||
|
||||
aSort = GetSortKeys().Copy()
|
||||
For I = 0 To aSort.Max
|
||||
aSort[I] = $DB.Quote(aSort[I])
|
||||
Next
|
||||
|
||||
sSelect = "ROW_NUMBER() OVER (ORDER BY " & aSort.Join() & ") AS __index"
|
||||
sSelect = "ROW_NUMBER() OVER (" & $DB.SQL.OrderBy(GetSortKeys())() & ") AS __index"
|
||||
sReq = $DB.SQL.Select([sSelect, "*"]).From($sTable).Where($sFilter)()
|
||||
|
||||
sReq = "SELECT * FROM (" & sReq & ") WHERE " & sWhere
|
||||
|
|
|
@ -275,7 +275,6 @@ Public Sub Update()
|
|||
|
||||
End
|
||||
|
||||
|
||||
Private Function Columns_Read() As String[]
|
||||
|
||||
Return $aColumns.Copy()
|
||||
|
@ -804,10 +803,7 @@ End
|
|||
|
||||
Public Sub MoveNext()
|
||||
|
||||
If $bCreate Then
|
||||
MoveFirst
|
||||
Return
|
||||
Endif
|
||||
If $bCreate Then Return
|
||||
If $hCtrl.Row >= $hCtrl.Rows.Max Then Return
|
||||
If $hCtrl.Row < 0 Then Return
|
||||
Inc $hCtrl.Row
|
||||
|
@ -818,7 +814,7 @@ End
|
|||
Public Sub MovePrevious()
|
||||
|
||||
If $bCreate Then
|
||||
MoveFirst
|
||||
MoveLast
|
||||
Return
|
||||
Endif
|
||||
If $hCtrl.Row <= 0 Then Return
|
||||
|
@ -829,6 +825,8 @@ End
|
|||
|
||||
Public Sub MoveTo(Index As Integer)
|
||||
|
||||
If Index = Index_Read() Then Return
|
||||
If $bCreate Then $hCtrl.Row = -1
|
||||
SetCreate(False)
|
||||
$hCtrl.Row = Index
|
||||
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||
|
|
Loading…
Reference in a new issue