Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mySkill-x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angular
mySkill-x
Commits
95ec4e04
Commit
95ec4e04
authored
Apr 02, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export excel csv print
parent
26cc0a8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
12 deletions
+37
-12
datagrid-syncfution.component.html
...ts/datagrid-syncfution/datagrid-syncfution.component.html
+5
-5
datagrid-syncfution.component.ts
...ents/datagrid-syncfution/datagrid-syncfution.component.ts
+32
-7
No files found.
src/app/components/datagrid-syncfution/datagrid-syncfution.component.html
View file @
95ec4e04
...
@@ -8,14 +8,14 @@
...
@@ -8,14 +8,14 @@
[
allowMultiSorting
]='
true
'
>
[
allowMultiSorting
]='
true
'
>
<e-columns>
<e-columns>
<e-column
[
textAlign
]="'
center
'"
*
ngIf=
"checkBoxSetting"
[
allowEditing
]="
false
"
>
<e-column
headerText=
'checkboxSelect'
[
textAlign
]="'
center
'"
width=
'150'
*
ngIf=
"checkBoxSetting
"
>
<ng-template
#
headerTemplate
let-data
>
<ng-template
#
headerTemplate
let-data
*
ngIf=
"checkBoxSetting"
>
<input
type=
"checkbox"
[
id
]="'
checkbox-all
'"
class=
"ti-form-checkbox cursor-pointer"
<input
type=
"checkbox"
[
id
]="'
checkbox-all
'"
class=
"ti-form-checkbox cursor-pointer"
[
checked
]="
selectedItemsAll
"
(
click
)="
toggleSelectionAll
()"
>
[
checked
]="
selectedItemsAll
"
(
click
)="
toggleSelectionAll
()"
>
<label
[
for
]="'
checkbox-all
'"
class=
"font-size-12px font-weight-700 text-primary"
>
<label
[
for
]="'
checkbox-all
'"
class=
"font-size-12px font-weight-700 text-primary"
>
{{selectedItems.count}} Selected
</label>
{{selectedItems.count}} Selected
</label>
</ng-template>
</ng-template>
<ng-template
#
template
let-data
>
<ng-template
#
template
let-data
*
ngIf=
"checkBoxSetting"
>
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
<input
type=
"checkbox"
class=
"ti-form-checkbox cursor-pointer"
[
checked
]="
selectedItems
.
data
.
get
(
data
[
selectedItems
.
key
])
||
false
"
[
checked
]="
selectedItems
.
data
.
get
(
data
[
selectedItems
.
key
])
||
false
"
(
click
)="
toggleSelection
(
data
[
selectedItems
.
key
],
!
selectedItems
.
data
.
get
(
data
[
selectedItems
.
key
]))"
>
(
click
)="
toggleSelection
(
data
[
selectedItems
.
key
],
!
selectedItems
.
data
.
get
(
data
[
selectedItems
.
key
]))"
>
...
@@ -30,10 +30,10 @@
...
@@ -30,10 +30,10 @@
</ng-template>
</ng-template>
</e-column>
</e-column>
<e-column
headerText=
'action'
width=
'150'
textAlign=
'Center'
*
ngIf=
"actionSetting"
>
<e-column
headerText=
'action'
width=
'150'
textAlign=
'Center'
*
ngIf=
"actionSetting"
>
<ng-template
#
headerTemplate
let-data
>
<ng-template
#
headerTemplate
let-data
*
ngIf=
"actionSetting"
>
<span
class=
"font-size-12px font-weight-700 text-primary"
>
การจัดการ
</span>
<span
class=
"font-size-12px font-weight-700 text-primary"
>
การจัดการ
</span>
</ng-template>
</ng-template>
<ng-template
#
template
let-data
>
<ng-template
#
template
let-data
*
ngIf=
"actionSetting"
>
<i
class=
"ti ti-eye cursor-pointer i-gray fs-l px-1"
(
click
)="
onNextPage
(
data
)"
*
ngIf=
"canChild"
></i>
<i
class=
"ti ti-eye cursor-pointer i-gray fs-l px-1"
(
click
)="
onNextPage
(
data
)"
*
ngIf=
"canChild"
></i>
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
[
attr
.
data-hs-overlay
]="
modalName
"
*
ngIf=
"canEdit"
<i
class=
"ti ti-edit cursor-pointer i-gray fs-l px-1"
[
attr
.
data-hs-overlay
]="
modalName
"
*
ngIf=
"canEdit"
(
click
)="
onSelectData
(
data
)"
></i>
(
click
)="
onSelectData
(
data
)"
></i>
...
...
src/app/components/datagrid-syncfution/datagrid-syncfution.component.ts
View file @
95ec4e04
...
@@ -6,7 +6,8 @@ import {
...
@@ -6,7 +6,8 @@ import {
ViewEncapsulation
,
ViewEncapsulation
,
OnInit
,
OnInit
,
ViewChild
,
ViewChild
,
SimpleChanges
SimpleChanges
,
ChangeDetectorRef
}
from
'@angular/core'
;
}
from
'@angular/core'
;
import
{
import
{
EditService
,
EditService
,
...
@@ -28,7 +29,9 @@ import {
...
@@ -28,7 +29,9 @@ import {
Grid
,
Grid
,
AggregateService
,
AggregateService
,
PdfExportProperties
,
PdfExportProperties
,
LoadingIndicatorModel
LoadingIndicatorModel
,
ExcelExportProperties
,
Column
}
from
'@syncfusion/ej2-angular-grids'
;
}
from
'@syncfusion/ej2-angular-grids'
;
import
{
GroupSettingsModel
,
FilterSettingsModel
,
ColumnModel
}
from
'@syncfusion/ej2-angular-grids'
;
import
{
GroupSettingsModel
,
FilterSettingsModel
,
ColumnModel
}
from
'@syncfusion/ej2-angular-grids'
;
import
{
DataManager
,
Query
}
from
'@syncfusion/ej2-data'
;
import
{
DataManager
,
Query
}
from
'@syncfusion/ej2-data'
;
...
@@ -121,7 +124,8 @@ export class DatagridSyncfutionComponent implements OnInit {
...
@@ -121,7 +124,8 @@ export class DatagridSyncfutionComponent implements OnInit {
// @Output() pageChanged = new EventEmitter<number>();
// @Output() pageChanged = new EventEmitter<number>();
// @Output() filterChanged = new EventEmitter<FilterEventArgs>();
// @Output() filterChanged = new EventEmitter<FilterEventArgs>();
// ...
// ...
constructor
(
private
cdr
:
ChangeDetectorRef
)
{
}
ngOnInit
():
void
{
ngOnInit
():
void
{
// this.query = new Query().addParams('dataCount', '1000');
// this.query = new Query().addParams('dataCount', '1000');
this
.
loadingIndicator
=
{
indicatorType
:
'Shimmer'
};
this
.
loadingIndicator
=
{
indicatorType
:
'Shimmer'
};
...
@@ -150,11 +154,32 @@ export class DatagridSyncfutionComponent implements OnInit {
...
@@ -150,11 +154,32 @@ export class DatagridSyncfutionComponent implements OnInit {
}
}
toolbarClick
(
args
:
any
):
void
{
toolbarClick
(
args
:
any
):
void
{
console
.
log
(
" 🐒 args.item.id:"
,
args
.
item
.
id
)
if
(
args
.
item
.
id
===
'Grid_excelexport'
)
{
if
(
args
.
item
.
id
===
'Grid_excelexport'
)
{
this
.
grid
?.
excelExport
();
let
exportProperties
:
ExcelExportProperties
=
{
}
columns
:
this
.
columns
.
map
(
col
=>
({
else
if
(
args
.
item
.
id
===
'Grid_csvexport'
)
{
field
:
col
.
field
,
this
.
grid
?.
csvExport
();
headerText
:
col
.
headerText
}))
as
Column
[]
};
this
.
grid
?.
excelExport
(
exportProperties
);
}
else
if
(
args
.
item
.
id
===
'Grid_csvexport'
)
{
let
exportColumns
=
this
.
columns
.
map
(
col
=>
({
field
:
col
.
field
!
,
headerText
:
col
.
headerText
!
}));
this
.
grid
?.
csvExport
({
columns
:
exportColumns
as
Column
[]
});
}
else
if
(
args
.
item
.
id
===
'Grid_print'
)
{
const
checkBoxSetting
=
this
.
checkBoxSetting
this
.
checkBoxSetting
=
false
const
actionSetting
=
this
.
actionSetting
this
.
actionSetting
=
false
this
.
cdr
.
detectChanges
()
setTimeout
(()
=>
{
this
.
checkBoxSetting
=
checkBoxSetting
this
.
actionSetting
=
actionSetting
this
.
cdr
.
detectChanges
()
},
1000
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment