mirror of https://github.com/anoshenko/rui.git
Bug fixing
This commit is contained in:
parent
4ec3fe2ff2
commit
7c0449775c
|
@ -1474,6 +1474,24 @@ function tableViewBlurEvent(element, event) {
|
|||
}
|
||||
}
|
||||
|
||||
function setTableCellCursorByID(tableID, row, column) {
|
||||
var table = document.getElementById(tableID);
|
||||
if (table) {
|
||||
if (!setTableCellCursor(table, row, column)) {
|
||||
const focusStyle = getTableFocusedItemStyle(table);
|
||||
const oldCellID = table.getAttribute("data-current");
|
||||
if (oldCellID) {
|
||||
const oldCell = document.getElementById(oldCellID);
|
||||
if (oldCell && oldCell.classList) {
|
||||
oldCell.classList.remove(focusStyle);
|
||||
oldCell.classList.remove(getTableSelectedItemStyle(table));
|
||||
}
|
||||
table.removeAttribute("data-current");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setTableCellCursor(element, row, column) {
|
||||
const cellID = element.id + "-" + row + "-" + column;
|
||||
var cell = document.getElementById(cellID);
|
||||
|
@ -1647,6 +1665,24 @@ function tableViewCellKeyDownEvent(element, event) {
|
|||
}
|
||||
}
|
||||
|
||||
function setTableRowCursorByID(tableID, row) {
|
||||
var table = document.getElementById(tableID);
|
||||
if (table) {
|
||||
if (!setTableRowCursor(table, row)) {
|
||||
const focusStyle = getTableFocusedItemStyle(table);
|
||||
const oldRowID = table.getAttribute("data-current");
|
||||
if (oldRowID) {
|
||||
const oldRow = document.getElementById(oldRowID);
|
||||
if (oldRow && oldRow.classList) {
|
||||
oldRow.classList.remove(focusStyle);
|
||||
oldRow.classList.remove(getTableSelectedItemStyle(table));
|
||||
}
|
||||
table.removeAttribute("data-current");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setTableRowCursor(element, row) {
|
||||
const tableRowID = element.id + "-" + row;
|
||||
var tableRow = document.getElementById(tableRowID);
|
||||
|
@ -1661,7 +1697,6 @@ function setTableRowCursor(element, row) {
|
|||
if (oldRow && oldRow.classList) {
|
||||
oldRow.classList.remove(focusStyle);
|
||||
oldRow.classList.remove(getTableSelectedItemStyle(element));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ func (button *buttonData) CreateSuperView(session Session) View {
|
|||
HorizontalAlign: CenterAlign,
|
||||
VerticalAlign: CenterAlign,
|
||||
Orientation: StartToEndOrientation,
|
||||
TabIndex: 0,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
21
tableView.go
21
tableView.go
|
@ -524,10 +524,6 @@ func (table *tableViewData) set(tag string, value any) bool {
|
|||
|
||||
case Current:
|
||||
switch value := value.(type) {
|
||||
case int:
|
||||
table.current.Row = value
|
||||
table.current.Column = -1
|
||||
|
||||
case CellIndex:
|
||||
table.current = value
|
||||
|
||||
|
@ -554,6 +550,7 @@ func (table *tableViewData) set(tag string, value any) bool {
|
|||
table.current.Column = n[1]
|
||||
} else {
|
||||
notCompatibleType(tag, value)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
n, err := strconv.Atoi(value)
|
||||
|
@ -566,9 +563,14 @@ func (table *tableViewData) set(tag string, value any) bool {
|
|||
}
|
||||
|
||||
default:
|
||||
if n, ok := isInt(value); ok {
|
||||
table.current.Row = n
|
||||
table.current.Column = -1
|
||||
} else {
|
||||
notCompatibleType(tag, value)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
return table.viewData.set(tag, value)
|
||||
|
@ -585,9 +587,18 @@ func (table *tableViewData) propertyChanged(tag string) {
|
|||
CellBorder, HeadHeight, HeadStyle, FootHeight, FootStyle,
|
||||
CellPaddingTop, CellPaddingRight, CellPaddingBottom, CellPaddingLeft,
|
||||
TableCellClickedEvent, TableCellSelectedEvent, TableRowClickedEvent,
|
||||
TableRowSelectedEvent, AllowSelection, Current:
|
||||
TableRowSelectedEvent, AllowSelection:
|
||||
table.ReloadTableData()
|
||||
|
||||
case Current:
|
||||
switch GetTableSelectionMode(table) {
|
||||
case CellSelection:
|
||||
table.session.callFunc("setTableCellCursorByID", table.htmlID(), table.current.Row, table.current.Column)
|
||||
|
||||
case RowSelection:
|
||||
table.session.callFunc("setTableRowCursorByID", table.htmlID(), table.current.Row)
|
||||
}
|
||||
|
||||
case Gap:
|
||||
htmlID := table.htmlID()
|
||||
session := table.Session()
|
||||
|
|
Loading…
Reference in New Issue