Closed sidazhang closed 9 years ago
Hi @sidazhang
I guess your question is about the custom views like this one If that's the case you can pull the examples repository and see how the custom views are configured there. Also take a look at the documentation
@simov, the question is actually simpler than a custom view!
It was asking about database view like this: http://www.postgresql.org/docs/8.3/static/tutorial-views.html
When reading, database views are basically the same as tables. And in custom.json, I also see that express-admin has pulled all the relevant database view datas. However, it is only rendering the tables.
Is there a way to render the views as well?
:+1: This would be very helpful!
Ok, I got it. Marked this issue as a feature.
@sidazhang currently showing sql views is not supported. I'll make a few tests first to get an idea of how the code base should be updated.
@simov Thanks!
I am surprised that it doesn't support views (but then I am not familiar the code base :P ), since views is basically exactly the same as tables queries wise.
custom.json also already grabs the column information of the views as well!
@sidazhang I think adding of readonly views will be relatively easy to implement. Non readonly views will require a bit more thinking, because the admin's listview and editview are designed for tables with primary key. As I'm understanding the views have specific requirements in order to update them, also obviously they don't have their own primary key. So do you have such views in your use case?
@simov My use case involves strictly readonly views.
Supporting readonly views would be an awesome feature :+1:
Thank you very much :)
@sidazhang just pushed the fix. I still don't have tests for it, but in the meantime you can pull master and test it out with your views.
Here are the steps you can make, essentially that will be the test for readonly views:
In settings.json
you have all views added as regular tables + they have one additional key "view":true
"my_view": {
"table":{
...
"view": true
}
}
Keep in mind that some of the settings options for regular tables won't work for views.
Hi,
I am only able to see tables in express-admin however, I am not able to see database views. Is there a way to enable views?