diff --git a/pglab/widgets/CatalogTablesPage.cpp b/pglab/widgets/CatalogTablesPage.cpp index 1d0aaaa..75d840f 100644 --- a/pglab/widgets/CatalogTablesPage.cpp +++ b/pglab/widgets/CatalogTablesPage.cpp @@ -110,7 +110,8 @@ void CatalogTablesPage::tableListTable_currentRowChanged(const QModelIndex &curr { if (current.row() != previous.row()) { if (current.isValid()) { - PgClass table = m_tablesModel->getTable(current.row()); + auto row = m_tablesSortFilter->mapToSource(current).row(); + PgClass table = m_tablesModel->getTable(row); selectedTableChanged(table); } else @@ -123,7 +124,8 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QListselectionModel()->currentIndex(); if (index.isValid()) { - PgClass table = m_tablesModel->getTable(index.row()); + auto row = m_tablesSortFilter->mapToSource(index).row(); + PgClass table = m_tablesModel->getTable(row); selectedTableChanged(table); } else @@ -132,7 +134,9 @@ void CatalogTablesPage::tableListTable_layoutChanged(const QListgetTable(index.row()); + + auto row = m_tablesSortFilter->mapToSource(index).row(); + PgClass table = m_tablesModel->getTable(row); if (table.oid() != InvalidOid) { // context()->moduleAction("pglab.crudpage", "open", { // { "oid", table.oid() }