Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 0698427

Browse files
author
DashukVolodymyr
committed
magento/devdocs#: Added rowbuilder info
1 parent 4bfd722 commit 0698427

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/guides/v2.3/javascript-dev-guide/widgets/widget-row-builder.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,50 @@ The following example shows a PHTML file using the script:
5454
</script>
5555
```
5656

57+
The following example shows a PHTML file using the script with some data:
58+
59+
```html
60+
<script>
61+
require([
62+
'jquery',
63+
'rowBuilder'
64+
], function ($) {
65+
'use strict';
66+
67+
var data = {
68+
formData: [
69+
["field1-name1", "field2-name1", "field3-name1"],
70+
["field1-name2", "field2-name2", "field3-name2"],
71+
["field1-name3", "field2-name3", "field3-name3"],
72+
["field1-name4", "field2-name4", "field3-name4"],
73+
],
74+
templateFields: [
75+
"field1-name", "field2-name", "field3-name"
76+
]
77+
};
78+
79+
$(".row-builder-package-manager").rowBuilder({
80+
"rowTemplate": "#row-template",
81+
"rowContainer": "#row-container",
82+
"rowParentElem": "<div></div>",
83+
"remEventSelector": "a",
84+
"btnRemoveSelector": ".action.remove",
85+
"formDataPost": data
86+
});
87+
});
88+
</script>
89+
```
90+
91+
This is provided during widget instantiation. For example:
92+
93+
```
94+
formDataPost : {"formData":formData,"templateFields":['field1-name','field2-name'] }
95+
```
96+
97+
-`"formData"` is the multi-dimensional array of form field values : [['a','b'],['c','b']] received from the server and encoded
98+
99+
-`"templateFields"` are the input fields in the template with index suffixed after the field name. For example, `field1-name{index}`, `field2-name{index}`, `field3-name{index}`
100+
57101
## Options
58102

59103
The PopupWindow widget has the following options:

0 commit comments

Comments
 (0)