This repository was archived by the owner on Nov 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +45
-16
lines changed
src/guides/v2.3/ui_comp_guide/components Expand file tree Collapse file tree 1 file changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -25,22 +25,51 @@ Extends [`uiCollection`]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_uicol
25
25
26
26
## Examples
27
27
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
+ });
44
73
```
45
74
46
75
#### Result
You can’t perform that action at this time.
0 commit comments