@@ -123,18 +123,18 @@ define([
123123var colName = $ ( this ) . find ( 'option:selected' ) . text ( ) ;
124124var colDtype = $ ( this ) . find ( 'option:selected' ) . attr ( 'data-type' ) ;
125125that . state . groupingVariable = colCode ;
126- $ ( that . wrapSelector ( '#group1' ) ) . html ( '' ) ;
127- $ ( that . wrapSelector ( '#group2' ) ) . html ( '' ) ;
128126// get result and load column list
129127vpKernel . getColumnCategory ( that . state . data , colCode ) . then ( function ( resultObj ) {
130128let { result} = resultObj ;
129+ $ ( that . wrapSelector ( '#group1' ) ) . html ( '' ) ;
130+ $ ( that . wrapSelector ( '#group2' ) ) . html ( '' ) ;
131131try {
132132var category = JSON . parse ( result ) ;
133133if ( category && category . length > 0 && colDtype == 'object' ) {
134134// if it's categorical column and its dtype is object, check 'Text' as default
135135category . forEach ( obj => {
136136let selected1 = obj . value === that . state . group1 ;
137- let selected2 = obj . value === that . state . group1 ;
137+ let selected2 = obj . value === that . state . group2 ;
138138$ ( that . wrapSelector ( '#group1' ) ) . append ( `<option value="${ obj . value } "${ selected1 ?'selected' :'' } >${ obj . label } </option>` ) ;
139139$ ( that . wrapSelector ( '#group2' ) ) . append ( `<option value="${ obj . value } "${ selected2 ?'selected' :'' } >${ obj . label } </option>` ) ;
140140} ) ;