Skip to content

Commit 34bc1d6

Browse files
author
minjk-bl
committed
Add description for Subset types
1 parent a4ba2a1 commit 34bc1d6

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

html/m_apps/subset.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
<!-- Subset type -->
3030
<select class="vp-ds-subset-type vp-select">
3131
<option value="subset">subset</option>
32-
<option value="loc">loc</option>
33-
<option value="iloc">iloc</option>
32+
<option value="loc">loc (location)</option>
33+
<option value="iloc">iloc (integer location)</option>
3434
<option value="query">query</option>
3535
</select>
3636
<!-- to frame -->

js/m_apps/Frame.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ define([
588588
var prevValue = that.state.originObj;
589589
if (varList && varList.length > 0 && prevValue == '') {
590590
prevValue = varList[0].varName;
591+
that.state.originObj = prevValue;
591592
}
592593
// replace
593594
that.renderVariableList(varList, prevValue);

js/m_apps/Subset.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ define([
4949
// specify pandas object types
5050
this.pdObjTypes = ['DataFrame', 'Series'];
5151
this.allowSubsetTypes = ['subset', 'iloc', 'loc', 'query'];
52+
this.subsetLabels = {
53+
'subset': 'subset',
54+
'iloc' : 'iloc (integer location)',
55+
'loc' : 'loc (location)',
56+
'query' : 'query'
57+
};
5258
if (this.prop.allowSubsetTypes) {
5359
this.allowSubsetTypes = this.prop.allowSubsetTypes;
5460
}
@@ -160,12 +166,14 @@ define([
160166
}
161167
renderSubsetType(dataType) {
162168
var subsetType = this.state.subsetType;
169+
let that = this;
163170

164171
var tag = new com_String();
165172
tag.appendFormatLine('<select class="{0} {1}">', VP_DS_SUBSET_TYPE, 'vp-select');
166173
this.allowSubsetTypes.forEach(thisType => {
167174
if (thisType != 'query' || dataType == 'DataFrame') {
168-
tag.appendFormatLine('<option value="{0}" {1}>{2}</option>', thisType, subsetType == thisType?'selected':'', thisType);
175+
let label = that.subsetLabels[thisType];
176+
tag.appendFormatLine('<option value="{0}" {1}>{2}</option>', thisType, subsetType == thisType?'selected':'', label);
169177
}
170178
});
171179
// tag.appendFormatLine('<option value="{0}" {1}>{2}</option>', 'subset', subsetType == 'subset'?'selected':'', 'subset');
@@ -619,7 +627,7 @@ define([
619627
* - render on VP_DS_PANDAS_OBJECT
620628
*/
621629
loadVariables() {
622-
var that = this;
630+
let that = this;
623631
var types = that.pdObjTypes;
624632
var prevValue = this.state.pandasObject;
625633

@@ -688,7 +696,7 @@ define([
688696
}
689697
}
690698
loadSubsetType(dataType) {
691-
var that = this;
699+
let that = this;
692700
$(this.wrapSelector('.' + VP_DS_SUBSET_TYPE)).replaceWith(function () {
693701
return that.renderSubsetType(dataType);
694702
});

0 commit comments

Comments
 (0)