Date_format not working with set_relation

Hello,

on the config file of grocery crud enterprise I have it set up as “us-date” however on the datagrid it’s still pulling from the database as sql-format while using setRelation

Hello @gabe152006 ,

Grocery CRUD is using only one field type for each field, so you can’t really combine two field types together. When you use any transformation of a field (for example setRelation, setFieldUpload or even callbackColumn this is treating it as a different field type) that it is not possible with the current implementation of Grocery CRUD to bypass.

The only way to do that is with Custom Models or by using the replace state and change the default behaviour of the state.

On the other hand as this is an interesting problem that I’ve never thought about, I will try to spend some time to see if this can be fixed automatically by Grocery CRUD.

Regards
Johnny

From further investigation it seems that (as I initially thought) this is not that easy to apply multiple field types for the same field.

There is a work-around that I could find though. You can use the fieldType method and use your own dropdown list with search. For example by using the field type dropdown_search.

With this solution you can transform the data that you would like for the dropdown and also show to the end user the transformed data.

Let me know if that helped.

Regards
Johnny

@johnny,

Thanks for the work-around, I will try it out. I am interested in the custom model section that could help me filter the data. As I have said before, there is a lot missing on the documentation of grocery crud about how to create a custom model for CI4, all that is there, is a CI3 example but it’s missing the base explanation on what methods are available to use with the Zend integration because if you just create your own method names on the custom model it doesn’t work. Is it possible that you take a look at my other question on this forum?

Thank you so much