Forums › Forums › OroPlatform › OroPlatform – How do I? Questions › How do I create a simple datagrid?
This topic contains 11 replies, has 5 voices, and was last updated by ruizalexandre 9 years, 10 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- April 24, 2014 at 1:13 am #35658
- CreatorTopic
- AuthorReplies
- April 24, 2014 at 1:16 am #35659
The documentation I was talking about: https://magecore.atlassian.net/wiki/display/DOC/Oro+Documentation+Home
April 24, 2014 at 6:02 am #35660Hello, lennart.
> https://magecore.atlassian.net/wiki/display/DOC/Oro+Documentation+Home
Yes, this documentation is outdated, we need to remove it.Actual documentation now is here: https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/DataGridBundle/Resources/doc/backend/datagrid.md.
In OroCRM datagrid defined in declarative style using files datagrid.yml. As an example you can use grids from UserBundle (https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/UserBundle/Resources/config/datagrid.yml) – they are quite simple and easy to understand.
May 5, 2014 at 6:01 am #35661Thanks!
May 6, 2014 at 5:44 am #35662How to create a simple grid, and when you click on an line, you’re redirected to the view page of this line ?
Thanks.May 6, 2014 at 1:32 pm #35663Just wanted to check if you had a chance to review documentation and example listed above, was it helpful or you would like to see something more there?
May 7, 2014 at 1:47 am #35664I finally managed to do what I wanted, thank you for your service and documentation.
May 27, 2014 at 7:19 am #35665How I can make my join with 2 tables?
I wrote this1234567891011121314151617181920212223242526272829relance-account-datagrid:source:type: ormquery:select: [ o.id, o.name, o.defaultContact, o.isActiveReminder, o.external_id ]from:- { table:RelanceAccountBundle:Account, alias: o }join:inner:-join: OroCRMContactBundle:Contactalias: contactconditionType: WITHcondition: "o.defaultContact = contact.id"orderBy:[ o.id ]columns:id:label: IDname:label: COMPANY NAMEcontact:label: CONTACTisActiveReminder:label: IS ACTIVE REMINDERexternal_id:label: EXTERNAL IDBut OroCRM says that I’ve an error
1[Semantical Error] OroCRMContactBundle:Contact has no field or association named defaultContactMay 28, 2014 at 12:52 am #35666Is there a field defaultContact in your entity class and have you created a relationship with contact? If you have, there should be a column in your database called something like defaultContact_id. Take a look at the user bundle entities for creating relations.
If you have done this correctly and your would select o.defaultContact, it will give some other error because it’s an object and not a field. I used this for a join:
12345join:left:- { join: o.type, alias: type }But i did not select o.type. In you case this would be something like:
12345join:left:- { join: o.defaultContact, alias: defaultContact }I hope this will help you
May 28, 2014 at 7:13 am #35667My entity Account extend from OroCRMAccountBundle:Account.
But when I use your method I’ve the same error messagedatagrid.yml
1234567891011121314151617181920212223242526272829relance-account-datagrid:source:type: ormquery:select: [ o.id, o.name, o.defaultContact, o.isActiveReminder, o.external_id ]from:- { table:RelanceAccountBundle:Account, alias: o }join:left:- { join: o.defaultContact, alias: defaultContact }inner:-join: OroCRMContactBundle:Contactalias: contactconditionType: WITHcondition: "o.defaultContact = contact"columns:id:label: IDname:label: COMPANY NAMEcontact:label: CONTACTisActiveReminder:label: IS ACTIVE REMINDERexternal_id:label: EXTERNAL IDTemplate.html.twig
123An exception has been thrown during the rendering of a template ("[Semantical Error] line 0, col 23 near 'defaultContact,': Error: Invalid PathExpression. Must be a StateFieldPathExpression.") in RelanceAccountBundle:Default:index.html.twig at line 4.May 28, 2014 at 8:00 am #35668You are close now. Remove o.defaultContact from select. That will do it.
Else try to remove this too:
123456789inner:-join: OroCRMContactBundle:Contactalias: contactconditionType: WITHcondition: "o.defaultContact = contact"June 2, 2014 at 2:42 am #35669Oh thanks for all.
Have a good day! - AuthorReplies
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.