45 #ifndef __WTX_DBO_TABLEVIEW_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__ 46 #define __WTX_DBO_TABLEVIEW_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__ 48 #include <Wtx/Core/Core.h> 49 #include <Wt/Dbo/Query.h> 50 #include "QueryModel.h" 52 #include <Wtx/Dbo/Session.h> 53 #include <Wtx/Dbo/TableDef.h> 54 #include <Wtx/TableView.h> 55 #include <Wtx/TableViewDef.h> 79 bool loadLayout(
const std::string & name );
80 void saveLayout(
const std::string & name );
84 const std::shared_ptr< Wtx::Dbo::QueryModel< Wt::Dbo::ptr<C> > > & model()
const 89 virtual void showHeaderPopup(
const Wt::WMouseEvent & event );
90 std::string layoutName(
const std::string & name )
const;
93 void refreshSelected();
95 const std::string & filter()
const;
97 void setFilter(
const std::string & filter );
98 void setSearch(
const std::string & search );
99 void setSubFilter(
const std::string & filter );
101 const std::string & queryValue()
const;
102 void setQuery(
const std::string & search =
"" );
106 int queryRowCount()
const 108 return m_queryRowCount;
113 Wt::Dbo::Transaction t(*session());
117 "SELECT COUNT(id) FROM \"" 118 + std::string( session()->
template tableName<C>() ) +
"\"" 121 if( viewDef().m_def.filter !=
"" )
122 filter +=
" WHERE " + viewDef().m_def.filter;
129 template query<int>( filter );
134 Wt::Dbo::ptr<C> item( Wt::WModelIndex index )
136 Wt::Dbo::ptr<C> retVal;
138 if( index.isValid() )
140 retVal = model()-> stableResultRow( index.row() );
147 void selectItem( Wt::Dbo::ptr<C> item );
149 Wt::Dbo::ptr<C> selectedItem();
153 void on_keyPressed( Wt::WKeyEvent keyEvent );
158 std::string m_filterValue;
159 std::string m_subFilterValue;
160 std::string m_queryValue;
161 bool colsSet =
false;
163 std::shared_ptr< Wtx::Dbo::QueryModel< Wt::Dbo::ptr<C> > > m_model;
164 int m_queryRowCount = -1;
171 #include "TableView_imp.h" 173 #endif // __WTX_DBO_TABLEVIEW_H___ void setQuery(const std::string &search="")