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

Commit 830bd2e

Browse files
ui-columncontrols-clarification-7730
1 parent b2e11e4 commit 830bd2e

File tree

1 file changed

+45
-16
lines changed

1 file changed

+45
-16
lines changed

src/guides/v2.3/ui_comp_guide/components/ui-columnscontrols.md

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,51 @@ Extends [`uiCollection`]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_uicol
2525

2626
## Examples
2727

28-
### Add ColumnsControls component to Listing basic component
29-
30-
```xml
31-
<listing>
32-
...
33-
<listingToolbar>
34-
...
35-
<columnsControls name="columns_controls">
36-
<settings>
37-
<minVisible>1</minVisible>
38-
<maxVisible>3</maxVisible>
39-
</settings>
40-
</columnsControls>
41-
</listingToolbar>
42-
...
43-
</listing>
28+
### You can simply change "minVisible" and "maxVisible" values in the JS file.
29+
30+
For this, you have to override the vendor JS file in your custom module.
31+
32+
vendor file js path :
33+
/vendor/magento/module-ui/view/base/web/js/grid/controls/columns.js
34+
35+
#### For override JS file follow step Below:
36+
37+
#### First step :
38+
/app/code/[VENDOR_NAME]/[MODULE_NAME]/view/base/requirejs-config.js
39+
40+
```js
41+
42+
var config = {
43+
map: {
44+
'*': {
45+
'Magento_Ui/js/grid/controls/columns':'VENDOR_NAME_MODULE_NAME/js/grid/controls/columns'
46+
}
47+
}
48+
}
49+
50+
```
51+
52+
#### Second step :
53+
/app/code/[VENDOR_NAME]/[MODULE_NAME]/view/base/web/js/grid/controls/columns.js
54+
(In this JS change "minVisible" and "maxVisible" values as per your requirement)
55+
56+
```js
57+
return Collection.extend({
58+
defaults: {
59+
template: 'ui/grid/controls/columns',
60+
minVisible: 1,
61+
maxVisible: 4,
62+
viewportSize: 18,
63+
displayArea: 'dataGridActions',
64+
columnsProvider: 'ns = ${ $.ns }, componentType = columns',
65+
imports: {
66+
addColumns: '${ $.columnsProvider }:elems'
67+
},
68+
templates: {
69+
headerMsg: $t('${ $.visible } out of ${ $.total } visible')
70+
}
71+
}
72+
});
4473
```
4574

4675
#### Result

0 commit comments

Comments
 (0)