bugfixes - hint displays

This commit is contained in:
Jan Prochazka 2020-03-08 21:01:24 +01:00
parent caf5453975
commit 8da0c359ff
2 changed files with 7 additions and 5 deletions

View File

@ -150,6 +150,7 @@ export abstract class GridDisplay {
select.columns.push({ select.columns.push({
exprType: 'column', exprType: 'column',
columnName: column.columnName, columnName: column.columnName,
alias: column.uniqueName,
source: { name: column, alias: parentAlias }, source: { name: column, alias: parentAlias },
}); });
res = 'refAdded'; res = 'refAdded';
@ -232,7 +233,7 @@ export abstract class GridDisplay {
select.columns.push({ select.columns.push({
exprType: 'column', exprType: 'column',
columnName: hintColumn.columnName, columnName: hintColumn.columnName,
alias: `hint_${column.columnName}`, alias: `hint_${column.uniqueName}`,
source: { alias: childAlias }, source: { alias: childAlias },
}); });
res = 'refAdded'; res = 'refAdded';
@ -252,7 +253,7 @@ export abstract class GridDisplay {
?.map(col => ({ ?.map(col => ({
...col, ...col,
isChecked: this.isColumnChecked(col), isChecked: this.isColumnChecked(col),
hintColumnName: col.foreignKey ? `hint_${col.columnName}` : null, hintColumnName: col.foreignKey ? `hint_${col.uniqueName}` : null,
})); }));
} }

View File

@ -168,6 +168,7 @@ export default function DataGridCore(props) {
React.useEffect(() => { React.useEffect(() => {
if (!isLoadedAll && firstVisibleRowScrollIndex + visibleRowCountUpperBound >= loadedRows.length) { if (!isLoadedAll && firstVisibleRowScrollIndex + visibleRowCountUpperBound >= loadedRows.length) {
const sql = display.getPageQuery(0, 1); const sql = display.getPageQuery(0, 1);
// try to get SQL, if success, load page. If not, callbacks to load missing metadata are dispatched
if (sql) loadNextData(); if (sql) loadNextData();
} }
if (display.cache.refreshTime > loadedTime) { if (display.cache.refreshTime > loadedTime) {
@ -300,7 +301,7 @@ export default function DataGridCore(props) {
<TableHeaderRow ref={headerRowRef}> <TableHeaderRow ref={headerRowRef}>
{realColumns.map(col => ( {realColumns.map(col => (
<TableHeaderCell <TableHeaderCell
key={col.columnName} key={col.uniqueName}
style={{ width: col.widthPx, minWidth: col.widthPx, maxWidth: col.widthPx }} style={{ width: col.widthPx, minWidth: col.widthPx, maxWidth: col.widthPx }}
> >
<ColumnLabel {...col} /> <ColumnLabel {...col} />
@ -315,10 +316,10 @@ export default function DataGridCore(props) {
<TableBodyRow key={firstVisibleRowScrollIndex + index}> <TableBodyRow key={firstVisibleRowScrollIndex + index}>
{realColumns.map(col => ( {realColumns.map(col => (
<TableBodyCell <TableBodyCell
key={col.columnName} key={col.uniqueName}
style={{ width: col.widthPx, minWidth: col.widthPx, maxWidth: col.widthPx }} style={{ width: col.widthPx, minWidth: col.widthPx, maxWidth: col.widthPx }}
> >
{row[col.columnName]} {row[col.uniqueName]}
{col.hintColumnName && <HintSpan>{row[col.hintColumnName]}</HintSpan>} {col.hintColumnName && <HintSpan>{row[col.hintColumnName]}</HintSpan>}
</TableBodyCell> </TableBodyCell>
))} ))}