Skip to content

Commit d84b7c8

Browse files
author
minjk-bl
committed
Fix MultiSelector not showing and loading bug
1 parent c37cb62 commit d84b7c8

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

visualpython/js/com/component/MultiSelector.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ define([
7777
} = this.config;
7878
this.mode = mode; // variable / columns / index / ndarray0 / ndarray1 / methods / data(given data)
7979
this.parent = parent;
80+
this.varType = type; // for mode:variable, variable type list to search
8081
this.selectedList = selectedList;
8182
this.includeList = includeList;
8283
this.excludeList = excludeList;
@@ -90,9 +91,11 @@ define([
9091

9192
var that = this;
9293

93-
if (parent == null || parent === '' || (Array.isArray(parent) && parent.length == 0)) {
94-
this._executeCallback([]);
95-
return;
94+
if (mode !== 'variable' && mode !== 'data') {
95+
if (parent == null || parent === '' || (Array.isArray(parent) && parent.length == 0)) {
96+
this._executeCallback([]);
97+
return;
98+
}
9699
}
97100
switch (mode) {
98101
case 'columns':
@@ -241,7 +244,8 @@ define([
241244
ndList.push({
242245
value: i,
243246
code: i,
244-
type: 'int'
247+
type: 'int',
248+
location: i
245249
});
246250
}
247251
callback(ndList);
@@ -270,7 +274,7 @@ define([
270274
var name = $(colTags[i]).data('name');
271275
var type = $(colTags[i]).data('type');
272276
var code = $(colTags[i]).data('code');
273-
if (code) {
277+
if (code != null) {
274278
dataList.push({ name: name, type: type, code: code});
275279
}
276280
}
@@ -355,22 +359,28 @@ define([
355359
info = '';
356360
}
357361
let iconStr = '';
362+
let infoStr = '';
358363
if (mode === 'columns') {
359364
if (data.isNumeric === true) {
360365
iconStr = '<span class="vp-icon-numeric mr5 vp-vertical-text"></span>';
361366
} else {
362367
iconStr = '<span class="vp-icon-non-numeric mr5 vp-vertical-text"></span>';
363368
}
369+
} else if (mode === 'variable') {
370+
infoStr = `<span class="vp-gray-text"> | ${data.type}</span>`;
364371
}
365372
// render item box
366-
tag.appendFormatLine('<div class="{0} {1}" data-idx="{2}" data-name="{3}" data-type="{4}" data-code="{5}" title="{6}">{7}<span>{8}</span></div>'
367-
, APP_SELECT_ITEM, APP_DRAGGABLE, data.location, data.value, data.type, data.code, info, iconStr, data.value);
373+
tag.appendFormat('<div class="{0} {1}" data-idx="{2}" data-name="{3}" data-type="{4}" data-code="{5}" title="{6}">'
374+
, APP_SELECT_ITEM, APP_DRAGGABLE, data.location, data.value, data.type, data.code, info);
375+
tag.appendFormat('{0}<span>{1}</span>{2}', iconStr, data.value, infoStr);
376+
tag.appendLine('</div>');
368377
});
369378
tag.appendLine('</div>'); // APP_SELECT_BOX
370379
return tag.toString();
371380
}
372381

373382
renderSelectedBox(dataList) {
383+
let mode = this.mode;
374384
var tag = new com_String();
375385
tag.appendFormatLine('<div class="{0} {1} {2} {3}">', APP_SELECT_BOX, 'right', APP_DROPPABLE, 'no-selection vp-scrollbar');
376386
// get data and make draggable items
@@ -383,16 +393,21 @@ define([
383393
info = '';
384394
}
385395
let iconStr = '';
396+
let infoStr = '';
386397
if (mode === 'columns') {
387398
if (data.isNumeric === true) {
388399
iconStr = '<span class="vp-icon-numeric mr5 vp-vertical-text"></span>';
389400
} else {
390401
iconStr = '<span class="vp-icon-non-numeric mr5 vp-vertical-text"></span>';
391402
}
403+
} else if (mode === 'variable') {
404+
infoStr = `<span class="vp-gray-text"> | ${data.type}</span>`;
392405
}
393406
// render item box
394-
tag.appendFormatLine('<div class="{0} {1} {2}" data-idx="{3}" data-name="{4}" data-type="{5}" data-code="{6}" title="{7}">{8}<span>{9}</span></div>'
395-
, APP_SELECT_ITEM, APP_DRAGGABLE, 'added', data.location, data.value, data.type, data.code, info, iconStr, data.value);
407+
tag.appendFormat('<div class="{0} {1} {2}" data-idx="{3}" data-name="{4}" data-type="{5}" data-code="{6}" title="{7}">'
408+
, APP_SELECT_ITEM, APP_DRAGGABLE, 'added', data.location, data.value, data.type, data.code, info);
409+
tag.appendFormat('{0}<span>{1}</span>{2}', iconStr, data.value, infoStr);
410+
tag.appendLine('</div>');
396411
});
397412
tag.appendLine('</div>'); // APP_SELECT_BOX
398413
return tag.toString();

0 commit comments

Comments
 (0)