Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Class set_data method throwing error #2765

Closed
dmc-webdev opened this issue Jan 17, 2023 · 2 comments · Fixed by #2794
Closed

Table Class set_data method throwing error #2765

dmc-webdev opened this issue Jan 17, 2023 · 2 comments · Fixed by #2794

Comments

@dmc-webdev
Copy link

I'm writing an add-on that outputs a table of data to the user. It is not for the CP, but it throws the following error:

No such property: 'cp' on ExpressionEngine\Legacy\Facade

ee/ExpressionEngine/Legacy/Facade.php:128

The code is in my mod.addon.php file in a method called results. Nothing fancy.

I removed my code and inserted the demo code from the Table Class docs into my method and it throws the same error. If I remove just the set_data call, it will output the table with the headers as expected. I'm not sure if it is intentional that the class only be used in the CP, but it seems like this should work in a module method as well.

Using EE 7.2.6

@intoeetive
Copy link
Contributor

@dmc-webdev it looks like the legacy table library contains some code that is designed to only work in CP.

We also have CP/Table table, which as well - as is stated in it's name - is designed to work in CP.

We will probably classify this as feature request, and not as a bug - but could you tell us more about your intended usage of Tables functionality on front-end, so we could think of best possible implementation?

@intoeetive intoeetive added the enhancement New feature or request label Jan 18, 2023
@dmc-webdev
Copy link
Author

I'm writing an add-on for a client that will pull race results from the Run Signup API. So taking the results array and just pushing it into the set_data method would be great. I have created the add-on to just have a tag pair with the race ID info passed into it. So get the race results from the API and output a table.

The set_columns and generate methods work without being in the CP. My work around right now is using add_row. That works, but it's cumbersome.

If you need anything more specific, just let me know.

@intoeetive intoeetive added enhancement: accepted and removed enhancement New feature or request labels Jan 23, 2023
intoeetive added a commit that referenced this issue Jan 30, 2023
intoeetive added a commit that referenced this issue Jan 30, 2023
matthewjohns0n added a commit that referenced this issue Feb 2, 2023
…e-out-of-cp

Resolved #2765 where using `ee()->table->set_data()` was not possible outside of Control Panel
matthewjohns0n added a commit that referenced this issue Feb 2, 2023
…e-out-of-cp

Resolved #2765 where using `ee()->table->set_data()` was not possible outside of Control Panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants