I'm using the Table class to render a table in my module and I want the user to be able to sort by clicking on column headers. I'm following the docs here, but when I use set_columns and set_data I get an error from libraries/EE_Table.php stating that EE::$cp is not defined.

Is it not possible to do sortable tables in the front-end? From the error, I guess it is only possible in the control panel.

1 Answer 1


EE uses the codeigniter table library .. http://ellislab.com/expressionengine/user-guide/development/cp_styles/index.html#table-based-layout

The issue you're probably running into is that it's trying to use one of the default CP styles. The library itself should be usable without being in the control panel, though jquery tablesorter may still be a better choice.

  • Thanks for the answer. I've managed to use the library to create tables without any problem, as it's easier to pass it arrays than to create HTML tables manually myself and I will look into using tablesorter for sorting. Feb 27, 2013 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.