1
1
2
2
import Vue from "vue" ;
3
3
import { FileManagerPlugin , DetailsView , NavigationPane , Toolbar } from "@syncfusion/ej2-vue-filemanager" ;
4
-
5
4
Vue . use ( FileManagerPlugin ) ;
5
+ import { CheckBox } from '@syncfusion/ej2-buttons' ;
6
6
7
7
new Vue ( {
8
8
el : '#app' ,
9
9
template : `
10
10
<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>
12
29
</ejs-filemanager>
13
30
</div>
14
31
` ,
@@ -22,25 +39,26 @@ new Vue({
22
39
uploadUrl : "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload" ,
23
40
downloadUrl : "https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Download"
24
41
} ,
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
27
43
} ;
28
44
} ,
29
45
provide : {
30
46
filemanager : [ DetailsView , NavigationPane , Toolbar ]
31
47
} ,
32
48
methods : {
33
49
// 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' ) ;
38
53
} ,
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' ;
44
62
}
45
63
}
46
64
}
0 commit comments