Commit 72f85f4 1 parent e264e61 commit 72f85f4 Copy full SHA for 72f85f4
File tree 2 files changed +23
-13
lines changed
2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,18 @@ const table = new LyxeaDatatable('#myTable', {
7
7
data : dataTableData ,
8
8
scrollCollapse : true ,
9
9
scrollY : 200 ,
10
+ columns : [
11
+ {
12
+ data : 'first_name' ,
13
+ name : 'first_name' ,
14
+ title : 'Prénom' ,
15
+ className : 'salut' ,
16
+ maSuperConfig : 'Ohé toto' ,
17
+ } ,
18
+ ] ,
10
19
lxConfig : {
11
20
filters : true ,
12
21
headers : [
13
- {
14
- columns : [
15
- {
16
- data : 'first_name' ,
17
- name : 'first_name' ,
18
- title : 'Prénom' ,
19
- className : 'salut' ,
20
- maSuperConfig : 'Ohé toto' ,
21
- } ,
22
- ] ,
23
- } ,
24
22
{
25
23
headerGroup : 'Mon super groupe' ,
26
24
columns : [
Original file line number Diff line number Diff line change @@ -170,6 +170,13 @@ class LyxeaDatatable<T>
170
170
}
171
171
172
172
if ( lxConfig ) {
173
+ /*
174
+ If columns in the standard object and in lxconfig, header generation is only based on lxconfig.
175
+ This allows you to generate the header with all the columns (and not just the columns defined in lxconfig).
176
+ */
177
+ if ( lxConfig . headers && standardColumns ) {
178
+ lxConfig . headers ?. unshift ( { 'columns' : [ ...standardColumns ] } ) ;
179
+ }
173
180
new LxRenderer ( lxConfig ) ;
174
181
const headersBuilder = this . #customColumnBuilder
175
182
. setColsDef ( lxConfig )
@@ -243,8 +250,6 @@ class LyxeaDatatable<T>
243
250
244
251
this . #dtButtons. parse ( this . config . buttons ) ;
245
252
246
- //@ts -ignore
247
- window . lxConfig = this . config ;
248
253
/**
249
254
* Initializing datatable
250
255
* Init event, get the datable instance on event.detail
@@ -273,6 +278,13 @@ class LyxeaDatatable<T>
273
278
__filterDataWithKey ( ) { }
274
279
275
280
handleBootrapTabChange < T > ( instance : DataTable < T > ) {
281
+ // For JQUERY user
282
+ if ( typeof $ == 'function' ) {
283
+ $ ( 'a[data-toggle="tab"]' ) . on ( 'shown.bs.tab' , function ( ) {
284
+ // @ts -ignore
285
+ instance . draw ( ) ;
286
+ } )
287
+ }
276
288
document . querySelectorAll ( 'button[data-bs-toggle="tab"]' ) . forEach ( ( el ) => {
277
289
el . addEventListener ( 'shown.bs.tab' , ( ) => {
278
290
// @ts -ignore
You can’t perform that action at this time.
0 commit comments