-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathTableHeader.js
112 lines (111 loc) · 4.88 KB
/
TableHeader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import React from 'react';
import includes from 'lodash/includes';
import style from '../style';
export default function TableHeader(props){
console.log(props)
if(props.config.show_length_menu == true
|| props.config.show_filter == true
|| props.config.button.excel == true
|| props.config.button.csv == true
|| props.config.button.print == true){
return (
<div className="row table-head asrt-table-head" id={(props.id) ? props.id + "-table-head" : ""}>
<div className="col-md-6">
{(props.config.show_length_menu) ? (
<div className="input-group asrt-page-length">
<div className="input-group-addon input-group-prepend">
<span className="input-group-text" style={style.table_size}>
{(props.lengthMenuText[0]) ? props.lengthMenuText[0] : ''}
</span>
</div>
{(includes(props.config.language.length_menu, '_MENU_')) ? (
<select type="text" className="form-control" style={style.table_size_dropdown}
onChange={props.changePageSize}>
{props.config.length_menu.map((value, key) => {
return (<option key={value}>{value}</option>);
})}
<option value={props.recordLength}>All</option>
</select>
) : null}
<div className="input-group-addon input-group-prepend">
<span className="input-group-text" style={style.table_size}>
{(props.lengthMenuText[1]) ? props.lengthMenuText[1] : ''}
</span>
</div>
</div>
) : null}
</div>
<div className="col-md-6 float-right text-right">
{(props.config.show_filter) ? (
<div className="table_filter" style={style.table_filter}>
<input
type="search"
className="form-control"
placeholder={props.config.language.filter}
onChange={props.filterRecords} />
</div>
) : null}
<div className="table_tools" style={style.table_tool}>
{(props.config.button.excel) ? (
<button className="btn btn-primary buttons-excel"
tabIndex="0"
aria-controls="configuration_tbl"
title="Export to Excel"
style={style.table_tool_btn}
onClick={props.exportToExcel}>
<span>
<i className={(props&&props.config&&props.config.fa5_support)?"fas fa-file-excel":"fa fa-file-excel-o"} aria-hidden="true"></i>
</span>
</button>
) : null}
{(props.config.button.csv) ? (
<button className="btn btn-primary buttons-csv"
tabIndex="0"
aria-controls="configuration_tbl"
title="Export to CSV"
style={style.table_tool_btn}
onClick={props.exportToCSV}>
<span>
<i className={(props&&props.config&&props.config.fa5_support)?"fas fa-file-csv":"fa fa-file-text-o"} aria-hidden="true"></i>
</span>
</button>
) : null}
{(props.config.button.print) ? (
<button className="btn btn-primary buttons-pdf"
tabIndex="0"
aria-controls="configuration_tbl"
title="Export to PDF"
style={style.table_tool_btn}
onClick={props.exportToPDF}>
<span>
<i className={"glyphicon glyphicon-print "+((props&&props.config&&props.config.fa5_support)?"fas fa-print":"fa fa-print")} aria-hidden="true"></i>
</span>
</button>
) : null}
{(props.config.button.extra==true) ? (
props.extraButtons.map((elem,index)=>{
elem.clickCount=0;
elem.singleClickTimer='';
return (
<button className={elem.className ? elem.className : "btn btn-primary buttons-pdf"}
tabIndex="0"
aria-controls="configuration_tbl"
title={elem.title?elem.title:"Export to PDF"}
style={style.table_tool_btn}
onClick={(event)=>{
elem.onClick(event);
}}
key={index}>
{elem.children}
</button>
)
})
) : null}
</div>
</div>
</div>
);
} else {
return null;
}
}