added support for hidden columns

This commit is contained in:
Peter Schojer
2008-07-08 12:43:07 +00:00
parent 795601ec64
commit 693db42cee
3 changed files with 23 additions and 0 deletions

View File

@@ -490,6 +490,8 @@ void TableRenderer::renderColumn(const Table* pTable, const TableColumn& tc, int
ostr << ",sortable:true"; ostr << ",sortable:true";
else else
ostr << ",menuDisabled:true"; ostr << ",menuDisabled:true";
if (tc.isHidden())
ostr << ",hidden:true";
static TableCellHandlerFactory& fty = TableCellHandlerFactory::instance(); static TableCellHandlerFactory& fty = TableCellHandlerFactory::instance();

View File

@@ -96,6 +96,12 @@ public:
const std::string& getCustomRenderer() const; const std::string& getCustomRenderer() const;
/// Returns the custom JavaScript code used to render the values of this column. /// Returns the custom JavaScript code used to render the values of this column.
/// Empty string if none set /// Empty string if none set
void setHidden(bool hide);
/// Hides/Shows a tablecolumn
bool isHidden() const;
/// Returns the hidden status of the TableColumn
protected: protected:
virtual ~TableColumn(); virtual ~TableColumn();
@@ -104,6 +110,7 @@ protected:
private: private:
Cell::Ptr _pCell; Cell::Ptr _pCell;
bool _sortable; bool _sortable;
bool _hidden;
std::string _header; std::string _header;
std::string _customRenderer; std::string _customRenderer;
}; };
@@ -179,6 +186,18 @@ inline const std::string& TableColumn::getCustomRenderer() const
} }
inline void TableColumn::setHidden(bool hide)
{
_hidden = hide;
}
inline bool TableColumn::isHidden() const
{
return _hidden;
}
} } // namespace Poco::WebWidgets } } // namespace Poco::WebWidgets

View File

@@ -45,6 +45,7 @@ TableColumn::TableColumn(Cell::Ptr pCellFormat):
View(typeid(TableColumn)), View(typeid(TableColumn)),
_pCell(pCellFormat), _pCell(pCellFormat),
_sortable(false), _sortable(false),
_hidden(false),
_header() _header()
{ {
if (_pCell) if (_pCell)
@@ -56,6 +57,7 @@ TableColumn::TableColumn(Cell::Ptr pCellFormat, const std::string& name, int wid
View(typeid(TableColumn)), View(typeid(TableColumn)),
_pCell(pCellFormat), _pCell(pCellFormat),
_sortable(sortable), _sortable(sortable),
_hidden(false),
_header(name) _header(name)
{ {
setWidth(width); setWidth(width);