File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8080 }
8181
8282 moderno . registerLazyLoadTriggerCallback ( ( completion ) => {
83- // alert("callback");
83+ moderno . appendData ( newData )
8484 setTimeout ( ( ) => {
8585 completion ( ) ;
8686 } , 1000 )
Original file line number Diff line number Diff line change @@ -572,6 +572,36 @@ class TableModerno {
572572 $ ( `#${ this . tableID } .moderno-table-wrapper` ) . scroll ( ) ;
573573 }
574574
575+ /**
576+ * Load more data into table and re-set widths for new items
577+ * @param {Object } data New data to load the table with
578+ */
579+ appendData ( data , keepSort = false ) {
580+ this . prevTableData = [ ...this . prevTableData , ...data ] ;
581+ this . tableData = [ ...this . tableData , ...data ] ;
582+
583+ if ( ! keepSort ) {
584+ this . resetSortList ( ) ;
585+ }
586+
587+ var colKeys = this . getHeaderColumnDataKeys ( ) ;
588+ var clipClass = this . config . singleLineRows ? "clip" : "no-clip" ;
589+
590+ var dataString = "" ;
591+ for ( var i = 0 ; i < data . length ; i ++ ) {
592+ dataString += this . getRowString ( i , colKeys , clipClass ) ;
593+ }
594+ let oldHtml = $ ( `#${ this . tableID } .moderno-table-body` ) . html ( )
595+ $ ( `#${ this . tableID } .moderno-table-body` ) . html ( oldHtml + dataString ) ;
596+
597+ this . setWidthByColumn ( this . config . widthByColumn ) ;
598+ this . registerStickyColumnsLeft ( this . config . stickColumnsLeft ) ;
599+ this . registerStickyColumnsRight ( this . config . stickColumnsRight ) ;
600+ this . showTooltip ( ) ;
601+ $ ( `#${ this . tableID } .moderno-table-wrapper` ) . scroll ( ) ;
602+ }
603+
604+
575605 /**
576606 * Create a HTML string for new row to be inserted
577607 * @param {Object } row Object containing the information of row data
You can’t perform that action at this time.
0 commit comments