Skip to content

Commit e7565a1

Browse files
committed
Fixed #258 : Incorrect Behavior of 'Add All' and 'Del All' Buttons in Subset App
Ensure Proper Sorting of Items after 'Del All' Operation
1 parent cfbc858 commit e7565a1

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

visualpython/js/com/com_Kernel.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,14 @@ define([
610610
* @param {*} dataframe
611611
* @returns
612612
*/
613-
getRowList(dataframe) {
613+
getRowList(dataframe, start_idx) {
614614
var that = this;
615+
if (typeof start_idx === 'undefined') {
616+
start_idx = 0;
617+
}
618+
615619
return new Promise(function(resolve, reject) {
616-
that.execute(com_util.formatString('_vp_print(_vp_get_rows_list({0}))', dataframe))
620+
that.execute(com_util.formatString('_vp_print(_vp_get_rows_list({0}, {1}))', dataframe, start_idx))
617621
.then(function(resultObj) {
618622
resolve(resultObj);
619623
}).catch(function(err) {

visualpython/js/m_apps/Subset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ define([
349349
let start = that.state.rowLimit;
350350
let end = start + 10;
351351
let subsetVariable = com_util.formatString('{0}.iloc[{1}:{2}]', that.state.pandasObject, start, end);
352-
vpKernel.getRowList(subsetVariable).then(function (resultObj) {
352+
vpKernel.getRowList(subsetVariable, start).then(function (resultObj) {
353353
let { result } = resultObj;
354354
var { list:rowList } = JSON.parse(result);
355355
rowList = rowList.map(function (x) {

visualpython/python/pandasCommand.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@
1111
# from IPython.core.display is deprecated since IPython 7.14
1212
from IPython.display import display
1313

14-
def _vp_get_rows_list(df):
14+
def _vp_get_rows_list(df, start_idx=0):
1515
"""
1616
Get Rows List with Detail Information
1717
"""
1818
rowInfo = { 'name': df.index.name, 'level': df.index.nlevels, 'list': [] }
1919
indexType = str(df.index.dtype)
2020
# make dict for rows info
2121
for i, r in enumerate(df.index):
22-
rInfo = { 'label': r, 'value': r, 'location': i }
22+
rInfo = { 'label': r, 'value': r, 'location': start_idx + i }
23+
2324
# value
2425
if type(r).__name__ == 'str':
2526
rInfo['value'] = "'{}'".format(r)

0 commit comments

Comments
 (0)