How do I use text (string) columns in wpDataTables?

Text is probably the most common data type when working with tables in WordPress. In this post we briefly explain how to work with text columns in wpDataTables.

How do string columns work in wpDataTables?

String column is the default, and the most basic column type of wpDataTables. You can put any content in a string column, and it will be rendered “as is”. If you, for example, want to put some specific HTML (buttons, iframes, or anything else) in a string column, you can generate it in the data source, and it will be rendered on the front-end.

  • Rendering rules: newline characters in the input data source are translated to <br/> tags on the front-end. You can also use values from another table (foreign key) to configure relations to another wpDataTable and display names instead of IDs.
  • Sorting rules: alphabetical.
  • Applicable filter types: text, selectbox, multi selectbox, and checkbox.

Important note: if you use HTML inside string columns, sorting and filtering by that column can in some cases yield strange results, since the sorting rules also apply to the HTML itself.

What does a string column look like?

In the example employee table, the “First Name”, “Last Name”, and “Position” columns are string-type columns. The table has 100 rows with the columns id, First Name, Last name, Birth Date, Date Hired, and Position.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box