Skip to content

Commit 42a1623

Browse files
Integrated latest changes at 11-26-2024 4:30:07 AM
1 parent e30f6a2 commit 42a1623

File tree

3 files changed

+55
-24
lines changed

3 files changed

+55
-24
lines changed

ej2-vue/code-snippet/file-manager/toolbar-cs2/app.vue

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
<e-toolbaritem name="Rename"></e-toolbaritem>
1515
<e-toolbaritem name="Select" :template="'checkboxTemplate'">
1616
<template v-slot:checkboxTemplate>
17-
<div><ejs-checkbox ref="checkBoxInstance" :label='Select All' :checked=false :change="onChange"></ejs-checkbox></div>
17+
<div>
18+
<ejs-checkbox ref="checkBoxInstance" :label="chkLabel" :checked="false" :change="onChange" ></ejs-checkbox>
19+
</div>
1820
</template>
1921
</e-toolbaritem>
2022
<e-toolbaritem name="Selection"></e-toolbaritem>
@@ -45,23 +47,34 @@ export default {
4547
getImageUrl: "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/GetImage",
4648
uploadUrl: "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload",
4749
downloadUrl: "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Download"
48-
}
50+
},
51+
label: 'Select All'
4952
};
5053
},
54+
computed: {
55+
chkLabel: {
56+
get: function () {
57+
return this.label;
58+
},
59+
set: function (label) {
60+
this.label = label;
61+
},
62+
},
63+
},
5164
provide: {
5265
filemanager: [DetailsView, NavigationPane, Toolbar]
5366
},
5467
methods: {
55-
onChange: function(args){
68+
onChange: function (args) {
69+
var fileObj = this.$refs.filemanagerInstance;
5670
if (args.checked) {
57-
this.$refs.fileManagerInstance.selectAll();
58-
this.$refs.checkBoxInstance.label = 'Unselect All';
59-
}
60-
else {
61-
this.$refs.fileManagerInstance.clearSelection();
62-
this.$refs.checkBoxInstance.label = 'Select All';
71+
fileObj.selectAll();
72+
this.label = 'Unselect All';
73+
} else {
74+
fileObj.clearSelection();
75+
this.label = 'Select All';
6376
}
64-
}
77+
},
6578
}
6679
}
6780
</script>

ej2-vue/code-snippet/file-manager/toolbar-cs2/index.js

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11

22
import Vue from "vue";
33
import { FileManagerPlugin, DetailsView, NavigationPane, Toolbar } from "@syncfusion/ej2-vue-filemanager";
4-
54
Vue.use(FileManagerPlugin);
5+
import { CheckBox } from '@syncfusion/ej2-buttons';
66

77
new Vue({
88
el: '#app',
99
template: `
1010
<div id="app">
11-
<ejs-filemanager id="file-manager" ref="file_instance" :toolbarSettings="toolbarSettings" :ajaxSettings="ajaxSettings" :toolbarClick="toolbarClick" :toolbarCreate="toolbarCreate">
11+
<ejs-filemanager id="file-manager" ref="fileManagerInstance" :ajaxSettings="ajaxSettings" :created='create'>
12+
<e-toolbaritems>
13+
<e-toolbaritem name="NewFolder"></e-toolbaritem>
14+
<e-toolbaritem name="Upload"></e-toolbaritem>
15+
<e-toolbaritem name="SortBy"></e-toolbaritem>
16+
<e-toolbaritem name="Refresh"></e-toolbaritem>
17+
<e-toolbaritem name="Cut"></e-toolbaritem>
18+
<e-toolbaritem name="Copy"></e-toolbaritem>
19+
<e-toolbaritem name="Paste"></e-toolbaritem>
20+
<e-toolbaritem name="Delete"></e-toolbaritem>
21+
<e-toolbaritem name="Download"></e-toolbaritem>
22+
<e-toolbaritem name="Rename"></e-toolbaritem>
23+
<e-toolbaritem name="Select" template='<input type="checkbox" id="checkbox1" />'>
24+
</e-toolbaritem>
25+
<e-toolbaritem name="Selection"></e-toolbaritem>
26+
<e-toolbaritem name="View"></e-toolbaritem>
27+
<e-toolbaritem name="Details"></e-toolbaritem>
28+
</e-toolbaritems>
1229
</ejs-filemanager>
1330
</div>
1431
`,
@@ -22,25 +39,26 @@ new Vue({
2239
uploadUrl: "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload",
2340
downloadUrl: "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Download"
2441
},
25-
//Custom item added along with default items
26-
toolbarSettings: {items: ["NewFolder", "Custom", "Upload", "Delete", "Download", "Rename", "SortBy", "Refresh", "Selection", "View", "Details"]}
42+
checkBoxInstance: null
2743
};
2844
},
2945
provide: {
3046
filemanager: [DetailsView, NavigationPane, Toolbar]
3147
},
3248
methods: {
3349
// Alert displayed for custom toolbar item in toolbarClick event
34-
toolbarClick: function(args){
35-
if (args.item.text === "Custom") {
36-
alert("You have clicked custom toolbar item")
37-
}
50+
create: function(args){
51+
this.checkBoxInstance = new CheckBox({ label: 'Select All',checked: false, change: this.onChange });
52+
this.checkBoxInstance.appendTo('#checkbox1');
3853
},
39-
toolbarCreate: function(args) {
40-
for(let i: number = 0; i<args.items.length; i++) {
41-
if(args.items[i].id === this.$refs.file_instance.$el.id +"_tb_custom") {
42-
args.items[i].prefixIcon= "e-icons e-fe-tick";
43-
}
54+
onChange: function(args) {
55+
if (args.checked) {
56+
this.$refs.fileManagerInstance.selectAll();
57+
this.checkBoxInstance.label = 'Unselect All';
58+
}
59+
else{
60+
this.$refs.fileManagerInstance.clearSelection();
61+
this.checkBoxInstance.label = 'Select All';
4462
}
4563
}
4664
}

ej2-vue/code-snippet/file-manager/toolbar-cs2/systemjs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ System.config({
1010
}
1111
},
1212
paths: {
13-
"syncfusion:": "https://cdn.syncfusion.com/ej2/20.3.56/"
13+
"syncfusion:": "https://cdn.syncfusion.com/ej2/27.2.3/"
1414
},
1515
map: {
1616
typescript: "https://unpkg.com/typescript@2.2.2/lib/typescript.js",

0 commit comments

Comments
 (0)