File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -312,10 +312,16 @@ export abstract class Table {
312312 return [ ] . concat ( this . _survey . getUsedLocales ( ) ) ;
313313 }
314314
315- public refresh ( hard : boolean = false ) {
316- if ( hard ) {
317- this . initTableData ( this . data ) ;
318- }
315+ protected supportSoftRefresh ( ) {
316+ return false ;
317+ }
318+
319+ protected softRefresh ( ) {
320+ this . hardRefresh ( ) ;
321+ }
322+
323+ protected hardRefresh ( ) {
324+ this . initTableData ( this . data ) ;
319325 if ( this . isRendered ) {
320326 this . currentPageNumber = this . getPageNumber ( ) ;
321327 const targetNode = this . renderResult ;
@@ -326,6 +332,14 @@ export abstract class Table {
326332 }
327333 }
328334
335+ public refresh ( hard : boolean = false ) {
336+ if ( hard || ! this . supportSoftRefresh ( ) ) {
337+ this . hardRefresh ( ) ;
338+ } else {
339+ this . softRefresh ( ) ;
340+ }
341+ }
342+
329343 public destroy ( ) {
330344 this . clearCreatedRows ( ) ;
331345 this . extensions . destroy ( ) ;
Original file line number Diff line number Diff line change @@ -116,6 +116,15 @@ export class Tabulator extends Table {
116116 private tableContainer : HTMLElement = null ;
117117 private currentDownloadType : string = "" ;
118118
119+ protected supportSoftRefresh ( ) {
120+ return true ;
121+ }
122+
123+ protected softRefresh ( ) {
124+ if ( ! this . isRendered ) return ;
125+ this . layout ( true ) ;
126+ }
127+
119128 public render ( targetNode : HTMLElement | string ) : void {
120129 super . render ( targetNode ) ;
121130 if ( typeof targetNode === "string" ) {
You can’t perform that action at this time.
0 commit comments