Is there a fairly easy way of making “create” or “edit” views in a model’s CRUD to look nearly exactly the same as “view” view does?
I want to make a feeling of a kind-of in-place edit. User switches from “view” to “edit” and see nearly exactly the same (banded table), but with edit fields instead of non-editable values.
There are significant differences between these two kinds of views:
Thanks samdark and good to know that you are still active from time to time in the ol’ good 2.0 branch.
Is there any easy way to reuse the mechanism that DetailView uses to generate its underlying set of table-related methods? Like some kind of internal renderer, etc.
Ad 1. Consider use exact the same view for the ‘edit’ and ‘view’ scenarios without DetailView at all but then with some extra params causing render form fields in disabled state, without submit button etc. This will effectively works as a form rendered as a read-only view.
Ad 2. Ugly
Ad 3. Good way but require extra work with some fancy CSS.
Don’t know if you want to use a third party library, but Kartik has a DetailView widget for Yii2 with the possibility to edit. https://demos.krajee.com/bs4/detail-view