Wt  4.14.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::WTableColumn Class Reference

A table column. More...

#include <Wt/WTableColumn.h>

Inheritance diagram for Wt::WTableColumn:
[legend]

Public Member Functions

 WTableColumn ()
 Creates a new table column.
 
 ~WTableColumn ()
 Destructor.
 
WTable * table () const
 Returns the table to which this column belongs.
 
WTableCell * elementAt (int row)
 Access the column element at the given row.
 
int columnNum () const
 Returns the column number of this column in the table.
 
void setWidth (const WLength &width)
 Sets the column width.
 
WLength width () const
 Returns the column width.
 
void setStyleClass (const WString &style)
 Sets the CSS style class for this column.
 
const WString & styleClass () const
 Returns the CSS style class for this column.
 
void setId (const std::string &id)
 Sets the CSS Id.
 
virtual const std::string id () const override
 Returns the (unique) identifier for this object.
 
void setObjectName (const std::string &name) override
 Sets an object name.
 
- Public Member Functions inherited from Wt::WObject
void addChild (std::unique_ptr< WObject > child)
 Add a child WObject whose lifetime is determined by this WObject.
 
template<typename Child >
Child * addChild (std::unique_ptr< Child > child)
 Add a child WObject, returning a raw pointer.
 
std::unique_ptr< WObject > removeChild (WObject *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject.
 
template<typename Child >
std::unique_ptr< Child > removeChild (Child *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject.
 
virtual std::string objectName () const
 Returns the object name.
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations.
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation.
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation.
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance.
 
void isNotStateless ()
 Marks the current function as not stateless.
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method.
 
virtual bool resendFormData ()
 Returns whether the form data should be resent.
 
- Public Member Functions inherited from Wt::Core::observable
 observable () noexcept
 Default constructor.
 
virtual ~observable ()
 Destructor.
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...)) noexcept
 Protects a method call against object destruction.
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...) const) const noexcept
 Protects a const method call against object destruction.
 
template<typename Function >
auto bindSafe (const Function &function) noexcept
 Protects a function against object destruction.
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation.
 

Detailed Description

A table column.

A WTableColumn is returned by WTable::columnAt() and managing various properties of a single column in a table (it is however not a widget).

A table column corresponds to the HTML <col> tag.

See also
WTable, WTableRow

Constructor & Destructor Documentation

◆ WTableColumn()

Wt::WTableColumn::WTableColumn ( )

Creates a new table column.

Table columns must be added to a table using WTable::insertColumn() before you can access contents in it using elementAt().

Member Function Documentation

◆ columnNum()

int Wt::WTableColumn::columnNum ( ) const

Returns the column number of this column in the table.

Returns -1 if the column is not yet part of a table.

See also
WTable::columnAt()

◆ elementAt()

WTableCell * Wt::WTableColumn::elementAt ( int  row)

Access the column element at the given row.

Like WTable::elementAt(), if the row is beyond the current table dimensions, then the table is expanded automatically.

The column must be inserted within a table first.

◆ id()

const std::string Wt::WTableColumn::id ( ) const
overridevirtual

Returns the (unique) identifier for this object.

For a WWidget, this corresponds to the id of the DOM element that represents the widget. This is not entirely unique, since a composite widget shares the same id as its implementation.

By default, the id is auto-generated, unless a custom id is set for a widget using WWidget::setId().

See also
WWidget::jsRef()

Reimplemented from Wt::WObject.

◆ setId()

void Wt::WTableColumn::setId ( const std::string &  id)

Sets the CSS Id.

Sets a custom Id. Note that the Id must be unique across the whole widget tree, can only be set right after construction and cannot be changed.

See also
WObject::id()

◆ setObjectName()

void Wt::WTableColumn::setObjectName ( const std::string &  name)
overridevirtual

Sets an object name.

The object name can be used to easily identify a type of object in the DOM, and does not need to be unique. It will usually reflect the widget type or role.

If a WWidget has an object name, the object name is reflected in the data-object-name attribute. You can use this to find widgets in JavaScript (e.g. for automated testing) using:

document.querySelector('*[data-object-name="yourObjectNameHere"]')

The default object name is empty (no object name).

Reimplemented from Wt::WObject.

◆ setStyleClass()

void Wt::WTableColumn::setStyleClass ( const WString &  style)

Sets the CSS style class for this column.

The style is inherited by all table cells in this column.

See also
styleClass(), WWidget::setStyleClass()

◆ setWidth()

void Wt::WTableColumn::setWidth ( const WLength &  width)

Sets the column width.

The default column width is WLength::Auto.

See also
width(), WWidget::resize()

◆ styleClass()

const WString & Wt::WTableColumn::styleClass ( ) const

Returns the CSS style class for this column.

See also
styleClass(), WWidget::styleClass()

◆ table()

WTable * Wt::WTableColumn::table ( ) const

Returns the table to which this column belongs.

See also
WTable::rowAt()

◆ width()

WLength Wt::WTableColumn::width ( ) const

Returns the column width.

See also
setWidth(const WLength&)