ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 7 replies, has 3 voices, and was last updated by  Pavel Levin 3 years, 3 months ago.

  • Creator
    Topic
  • #4248

    Pavel Levin
    Participant

    Hello!
    I have two questions.
    How to disable formatting numeric field in the list? The field value is displayed with a separator – 10,001,152 instead 10001152.
    On detail page field shows correctly.
    How to apply custom decorator to my field? I want to display a numeric field as an external link.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #4250
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, Pavel Levin.

    > How to disable formatting numeric field in the list? The field value is displayed with a separator – 10,001,152 instead 10001152.
    If you are talking about the grids, then you can simply render it as string – so, numeric formatter will not be applied. To do that simply remove “frontend_type” from column declaration.

    > How to apply custom decorator to my field?
    It depends on where you are going to use it. The simplest way is to create twig extension with formatter function and use it anywhere you need – on view page, in grid inside twig template etc.

    #4251

    Pavel Levin
    Participant

    Hello, Yevhen!
    I have created a field in the Contacts module with a tool in the admin panel (Main menu -> System -> Entities). It does not contain “frontend_type”.
    Field page
    Grid

    I created an extension for Twig. Where is template for decorate client_id field on contact module view page? What is “right way” to do it?

    #4252
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Now I see. This field has type “integer”, so integer formatting applying to it everywhere. I think there is no easy way to customize it from UI because formatter uses locale defined format, and it automatically changed when you are changing locale.

    Fix from UI – you can use type “string” instead of “integer”, but in this case value will be stored as string, not as integer, so you will not be able to filter of sort by numeric value.

    Another option – create datagrid listener for this specific grid and manually set frontend_type to “string”, like here: https://github.com/orocrm/crm/blob/master/src/OroCRM/Bundle/SalesBundle/Resources/config/datagrid.yml#L44. Actually, in this listener you can customize anything in this grid – so, it’s the most flexible solution.

    #4254
    Dima Soroka
    Dima Soroka
    Oro Core

    We will implement type “Number” to cover this specific case, please keep looking into upcoming releases.

    #4294

    Pavel Levin
    Participant

    Dmitry, thanks, I’ll wait for the release.
    Yevhen, give an example implementation for my task.
    Custom fields decorating is very important issue and an example will be useful for many users.

    #4415
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Here is example of grid listener – https://github.com/orocrm/crm/blob/master/src/OroCRM/Bundle/CallBundle/EventListener/Datagrid/CallListener.php#L32. It does not exactly that you need, but main idea is the same – it simply customize datagrid configuration.

    #4515

    Pavel Levin
    Participant

    Hello!
    I created event listener for oro_datagrid.datagrid.build.before event, but $event->getConfig[‘columns’] doesnt contains my custom field.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.