我已经在Magento管理员的“客户编辑”表单中成功添加了带有网格的自定义标签。该选项卡<insertListing>
在其布局XML中使用标签来呈现网格,该网格应能正常工作。但是,当我尝试保存客户时,表单验证会引发错误。我已经调试这一点,似乎当validate()
的方法tab_group.js
试图调用该标签的validate
方法,它返回undefined
。我已将其与“商店信用”选项卡进行了比较,该选项卡是使用不推荐使用的Grid块创建的,对于该元素,它返回一个空数组。我的配置中缺少什么吗?
错误:
tab_group.js:68 Uncaught TypeError: Cannot read property 'valid' of undefined
at tab_group.js:68
at Function.findIndex (underscore.js:644)
at Function._.find._.detect (underscore.js:206)
at UiClass.validate (tab_group.js:67)
at Array.some (<anonymous>)
at UiClass.onValidate (tab_group.js:86)
at setNested (objects.js:43)
at Object.nested (objects.js:117)
at UiClass.set (element.js:305)
at updateValue (links.js:80)
(anonymous) @ tab_group.js:68
(anonymous) @ underscore.js:644
_.find._.detect @ underscore.js:206
validate @ tab_group.js:67
onValidate @ tab_group.js:86
setNested @ objects.js:43
nested @ objects.js:117
set @ element.js:305
updateValue @ links.js:80
(anonymous) @ events.js:87
trigger @ events.js:84
trigger @ events.js:162
validate @ form.js:333
save @ form.js:261
dispatch @ jquery.js:5226
elemData.handle @ jquery.js:4878
标签版式XML(view/base/ui_component/customer_form.xml
):
<?xml version="1.0"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="downloaded_blueprints" sortOrder="1000">
<settings>
<label translate="true">Downloaded Blueprints</label>
</settings>
<insertListing name="downloaded_blueprints_listing">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">blueprint_download</item>
</item>
</argument>
<settings>
<externalProvider>${ $.ns }.downloaded_blueprints_listing_data_source</externalProvider>
<autoRender>true</autoRender>
<dataScope>downloaded_blueprints_listing</dataScope>
<ns>downloaded_blueprints_listing</ns>
<exports>
<link name="customerId">${ $.externalProvider }:params.customer_id</link>
</exports>
<imports>
<link name="customerId">${ $.provider }:data.customer.entity_id</link>
</imports>
</settings>
</insertListing>
</fieldset>
</form>
请共享您的网格代码,当前共享的代码工作正常。
—
kunj