问题描述
我有一个独特的ORO CRM系统,带有一个与位置实体相连的位置表。 它具有ID,名称和父字段。我想使所有字段都可编辑,如下所示:
- 名称:作为字符串
- 父级:作为实体选择器。
根据描述和原始的ORO任务网格,我将其设为datagrid,但是在对parent字段进行成功更新之后,parent会更改为UI上的parent ID。
我的datadgrid的location.yml是以下内容:
datagrids:
locations-grid:
inline_editing:
enable: true
extended_entity_name: Entity\Location
source:
type: orm
query:
select:
- l
- p
from:
- { table: Entity\Location,alias: l }
join:
left:
- { join: l.parent,alias: p }
hints:
- HINT_TRANSLATABLE
columns:
name:
label: 'location.datagrid.field.name'
align: right
parent:
label: 'location.datagrid.field.parent'
inline_editing:
enable: true
entity_name: Entity\Location
behavIoUr: enable_selected
editor:
view: oroform/js/app/views/editor/related-id-relation-editor-view
view_options:
# Related value field name
value_field_name: parent
placeholder: 'pélszholder'
# required. Specifies available choices
autocomplete_api_accessor:
# class: oroui/js/tools/search-api-accessor
class: oroentity/js/tools/entity-select-search-api-accessor
# The entity name to search in. required for EntitySelectSearchApiAccessor
entity_name: Entity\Location
# Name of the search handler to use required for SearchApiAccessor
search_handler_name: locations
# Optional. Name of the property that will be used as an identifier. By default = 'id'
value_field_name: id
# The field to search by and to show in UI equired for EntitySelectSearchApiAccessor
field_name: name
# This value is the visible value on the dropdown list
label_field_name: name
properties:
id: ~
view_link:
type: url
route: location_view
params: [ id ]
update_link:
type: url
route: location_update
params: [ id ]
sorters:
columns:
name: { data_name: l.name }
parent: { data_name: p.name }
default:
name: ASC
parent: ASC
filters:
columns:
name:
type: string
data_name: l.name
parent:
data_name: l.parent
type: choice-tree
autocomplete_alias: locations
renderedPropertyName: 'parent'
className: 'Entity\Location'
actions:
view:
type: navigate
label: 'common.grid.details'
link: view_link
icon: eye
update:
type: navigate
label: 'common.grid.edit'
icon: edit
link: update_link
options:
entityHint: 'location.datagrid.entityhint'
export: true
entity_pagination: true
anybady有想法吗,如何在更新后显示父母的姓名而不是其ID? 提前预订!
安德烈!
是的,这是我对位置实体的search.yml:
search:
# Class to search in
Entity\Location:
# alias for searching by f.ex.: autocomplete_alias
alias: locations
label: 'location.search.label'
title_fields: [name,parent]
route:
# name to generate url to an entity.search_handler.search_handler
name: location_view
parameters:
id: id
fields:
- name: name
target_type: text
target_fields: [name]
- name: parent
relation_type: many-to-one
relation_fields:
-
name: name
target_type: text
target_fields: [parent]
search_template: Common:Partials:searchResult.html.twig
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)