Skip to content

Commit a31d345

Browse files
author
minjk-bl
committed
subset auto checking for categorical value
1 parent 60a11c7 commit a31d345

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/common/vpSubsetEditor.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,7 @@ define([
17601760
});
17611761

17621762
$(document).on('change', this.wrapSelector('.vp-ds-cond-tbl .vp-col-list'), function() {
1763+
var thisTag = $(this);
17631764
var varName = $(this).closest('td').find('.vp-cond-var').val();
17641765
var colName = $(this).find('option:selected').attr('data-code');
17651766

@@ -1769,6 +1770,12 @@ define([
17691770
// get result and load column list
17701771
kernelApi.executePython(code, function(result) {
17711772
var category = JSON.parse(result);
1773+
if (category && category.length > 0) {
1774+
// if it's categorical column, check 'Text' as default
1775+
$(thisTag).closest('td').find('.vp-cond-use-text').prop('checked', true);
1776+
} else {
1777+
$(thisTag).closest('td').find('.vp-cond-use-text').prop('checked', false);
1778+
}
17721779
$(condTag).replaceWith(function() {
17731780
return that.renderConditionCondInput(category);
17741781
});

0 commit comments

Comments
 (0)