Automatically create the async query when converting to a TableView

This commit is contained in:
Thomas Goyne 2015-12-09 18:05:48 -08:00
parent 8f668fdf09
commit 934263f76a

View File

@ -177,9 +177,14 @@ void Results::update_tableview()
m_mode = Mode::TableView;
break;
case Mode::TableView:
if (m_live) {
m_table_view.sync_if_needed();
if (!m_live) {
return;
}
if (!m_realm->config().read_only && !m_realm->is_in_transaction() && !m_background_query) {
m_background_query = std::make_shared<_impl::AsyncQuery>(*this);
_impl::RealmCoordinator::register_query(m_background_query);
}
m_table_view.sync_if_needed();
break;
}
}