@@ -251,8 +251,9 @@ export class VGridCtx {
251
251
/****************************************************************************************************************************
252
252
* explain
253
253
****************************************************************************************************************************/
254
- setColumns ( paramObj ) {
255
- this . vGridConfig . colConfig = paramObj . colConfig ;
254
+ setColumns ( paramArray ) {
255
+ this . vGridConfig . colConfig = paramArray ;
256
+ this . vGrid . vGridConfig . columnLength = paramArray . length
256
257
} ;
257
258
258
259
@@ -272,12 +273,81 @@ export class VGridCtx {
272
273
}
273
274
arr . push ( x ) ;
274
275
} ) ;
275
- return {
276
- "colConfig" : arr
277
- }
276
+ return arr
278
277
} ;
279
278
280
279
280
+ /****************************************************************************************************************************
281
+ * explain
282
+ ****************************************************************************************************************************/
283
+ reGenerateColumns ( resetScrollToTop ) {
284
+ this . vGrid . vGridMarkupGenerator . generate ( ) ;
285
+ this . vGridGenerator . columnChangeAndCollection ( resetScrollToTop ) ;
286
+ } ;
287
+
288
+
289
+ /****************************************************************************************************************************
290
+ * explain
291
+ ****************************************************************************************************************************/
292
+ orderBy ( sortArray ) {
293
+
294
+
295
+ //can we do the sorting?
296
+ if ( this . vGrid . vGridCollectionFiltered . length > 0 ) {
297
+ //set loading screen
298
+ if ( this . vGrid . vGridCollection . length > this . vGridConfig . attLoadingThreshold ) {
299
+ this . vGrid . loading = true ;
300
+ }
301
+
302
+ //set query
303
+ setTimeout ( ( ) => {
304
+
305
+ this . vGrid . vGridSort . reset ( ) ;
306
+ //set filter
307
+ sortArray . forEach ( ( sort ) => {
308
+ this . vGrid . vGridSort . setFilter ( {
309
+ attribute : sort . attribute ,
310
+ asc : sort . asc
311
+ } , true ) ;
312
+ } ) ;
313
+
314
+ let event = new CustomEvent ( "sortIconUpdate" , {
315
+ detail : "" ,
316
+ bubbles : true
317
+ } ) ;
318
+ this . vGrid . element . dispatchEvent ( event ) ;
319
+
320
+ //if remote call is set
321
+ if ( this . vGridConfig . eventOnRemoteCall ) {
322
+
323
+ //trigger remote call
324
+ this . vGridConfig . remoteCall ( ) ;
325
+
326
+ } else {
327
+ //run filter
328
+ this . vGrid . vGridSort . run ( this . vGrid . vGridCollectionFiltered ) ;
329
+
330
+ //set new row
331
+ if ( this . vGrid . vGridCurrentEntityRef ) {
332
+ this . vGrid . vGridCollectionFiltered . forEach ( ( x , index ) => {
333
+ if ( this . vGrid . vGridCurrentEntityRef [ this . vGrid . vGridRowKey ] === x [ this . vGrid . vGridRowKey ] ) {
334
+ this . vGrid . vGridCurrentRow = index ;
335
+ }
336
+ } ) ;
337
+ }
338
+
339
+ //update grid
340
+ this . vGrid . vGridGenerator . collectionChange ( ) ;
341
+ this . vGrid . loading = false ;
342
+ }
343
+
344
+ } , 50 ) ;
345
+ }
346
+
347
+
348
+ }
349
+
350
+
281
351
/****************************************************************************************************************************
282
352
* explain
283
353
****************************************************************************************************************************/
0 commit comments