forked from mbk-lab/rui_orig
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) {
|
function setTableCellCursor(element, row, column) {
|
||||||
const cellID = element.id + "-" + row + "-" + column;
|
const cellID = element.id + "-" + row + "-" + column;
|
||||||
var cell = document.getElementById(cellID);
|
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) {
|
function setTableRowCursor(element, row) {
|
||||||
const tableRowID = element.id + "-" + row;
|
const tableRowID = element.id + "-" + row;
|
||||||
var tableRow = document.getElementById(tableRowID);
|
var tableRow = document.getElementById(tableRowID);
|
||||||
|
@ -1661,7 +1697,6 @@ function setTableRowCursor(element, row) {
|
||||||
if (oldRow && oldRow.classList) {
|
if (oldRow && oldRow.classList) {
|
||||||
oldRow.classList.remove(focusStyle);
|
oldRow.classList.remove(focusStyle);
|
||||||
oldRow.classList.remove(getTableSelectedItemStyle(element));
|
oldRow.classList.remove(getTableSelectedItemStyle(element));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ func (button *buttonData) CreateSuperView(session Session) View {
|
||||||
HorizontalAlign: CenterAlign,
|
HorizontalAlign: CenterAlign,
|
||||||
VerticalAlign: CenterAlign,
|
VerticalAlign: CenterAlign,
|
||||||
Orientation: StartToEndOrientation,
|
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:
|
case Current:
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case int:
|
|
||||||
table.current.Row = value
|
|
||||||
table.current.Column = -1
|
|
||||||
|
|
||||||
case CellIndex:
|
case CellIndex:
|
||||||
table.current = value
|
table.current = value
|
||||||
|
|
||||||
|
@ -554,6 +550,7 @@ func (table *tableViewData) set(tag string, value any) bool {
|
||||||
table.current.Column = n[1]
|
table.current.Column = n[1]
|
||||||
} else {
|
} else {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
n, err := strconv.Atoi(value)
|
n, err := strconv.Atoi(value)
|
||||||
|
@ -566,9 +563,14 @@ func (table *tableViewData) set(tag string, value any) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if n, ok := isInt(value); ok {
|
||||||
|
table.current.Row = n
|
||||||
|
table.current.Column = -1
|
||||||
|
} else {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return table.viewData.set(tag, value)
|
return table.viewData.set(tag, value)
|
||||||
|
@ -585,9 +587,18 @@ func (table *tableViewData) propertyChanged(tag string) {
|
||||||
CellBorder, HeadHeight, HeadStyle, FootHeight, FootStyle,
|
CellBorder, HeadHeight, HeadStyle, FootHeight, FootStyle,
|
||||||
CellPaddingTop, CellPaddingRight, CellPaddingBottom, CellPaddingLeft,
|
CellPaddingTop, CellPaddingRight, CellPaddingBottom, CellPaddingLeft,
|
||||||
TableCellClickedEvent, TableCellSelectedEvent, TableRowClickedEvent,
|
TableCellClickedEvent, TableCellSelectedEvent, TableRowClickedEvent,
|
||||||
TableRowSelectedEvent, AllowSelection, Current:
|
TableRowSelectedEvent, AllowSelection:
|
||||||
table.ReloadTableData()
|
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:
|
case Gap:
|
||||||
htmlID := table.htmlID()
|
htmlID := table.htmlID()
|
||||||
session := table.Session()
|
session := table.Session()
|
||||||
|
|
Loading…
Reference in New Issue