This topic contains 4 replies, has 2 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
- May 27, 2014 at 6:41 am #30086
Hi, I want create a Datagrid of my entity Invoice.
This Datagrid is related at an Account (referenced with an ID).
How I can create this Datagrid, with1SELECT * FROM Invoices i WITH i.account = [my id]Thanks you.
- CreatorTopic
- AuthorReplies
- May 27, 2014 at 8:28 am #30087
Hello.
Please take a look to this FAQ. There is explanation how you can create it.
Also you can refer to already defined grids such as “order items for single order”.
Need to add where clause, listener and params in template.Hope this will help.
May 28, 2014 at 12:53 am #30088I have followed your example for the construction of the datagrid with parameters.
But I’ve this error :12345An exception has been thrown during the rendering of a template("Invalid parameter number: number of bound variables does not match number of tokens")in RelanceAccountBundle:Default:show.html.twig.I have created 3 files services.yml, datagrid.yml and my template.
services.yml
123456789101112parameters:services:relance_account.event_listener.cart_items_grid_listener:class: %oro_datagrid.event_listener.base_orm_relation.class%arguments:- 'id'- @oro_datagrid.datagrid.request_paramstags:- { name: kernel.event_listener, event: oro_datagrid.datagrid.build.after.relance-accountinvoice-datagrid, method: onBuildAfter }show.html.twig
12345{% extends "OroUIBundle:Default:index.html.twig" %}{% import 'OroDataGridBundle::macros.html.twig' as dataGrid %}{{ dataGrid.renderGrid('relance-accountinvoice-datagrid', {id: account.id}) }}datagrid.yml
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647datagrid:relance-accountinvoice-datagrid:source:type: ormquery:select: [ o.id, o.title, o.total_HT, o.total_TTC, o.invoiced_on, o.term_on, o.paid_on, o.isActiveReminder ]from:- { table:RelanceInvoiceBundle:Invoice, alias: o }join:left:- { join: o.account_id, alias: account }where:and:- o.account_id = :idcolumns:id:type: twiglabel: IDfrontend_type: htmltemplate: RelanceInvoiceBundle:Invoice:Datagrid/Property/invoiceTitle.html.twigtitle:label: TITLEtotal_HT:label: TOTAL HTtotal_TTC:label: TOTAL TTCinvoiced_on:label: INVOICED ONfrontend_type: dateterm_on:label: TERM ONfrontend_type: datepaid_on:label: PAID ONfrontend_type: dateisActiveReminder:type: twiglabel: IS ACTIVE REMINDERfrontend_type: htmltemplate: RelanceInvoiceBundle:Invoice:Datagrid/Property/invoiceIAR.html.twigid:type: twiglabel: ACTIONSfrontend_type: htmltemplate: RelanceInvoiceBundle:Invoice:Datagrid/Property/invoiceActions.html.twigMay 28, 2014 at 1:19 am #30089Please try to pass
123- falseinstead of
123- @oro_datagrid.datagrid.request_paramsTo event listener
May 28, 2014 at 4:40 am #30090Yes it’s working.
Thanks you. - AuthorReplies
The forum ‘OroCRM’ is closed to new topics and replies.