像GWT ListBox.setVisibleItemCount()一样,SmartGWT中是否有可用的API

时间:2018-08-03 10:37:52

标签: gwt listbox smartgwt

要在GWT ListBox 中设置可见项的数量,我们有ListBox.setVisibleItemCount()API,但我找不到任何方法可以在SmartGWT的 SelectItem 中实现相同的目的。我的要求是在SelectItem列表中显示图像和文本,就像在GWT中一样,我们应该能够一次显示多个项目。

有一个选项可以使用selectItem.setMultiple(true);设置多选择。和  selectItem.setMultipleAppearance(MultipleAppearance.GRID);但是,如果我们以此方式设置多选,则图片不会在列表框中显示,只有文本会出现。

我无法确定是否可以在SmartGWT的 SelectItem (带有图片)中显示多个项目,或者我是否在此处缺少任何内容。

1 个答案:

答案 0 :(得分:0)

这应该可行。这是SmartGWT官方展示柜中的示例。

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

data = {'Age': [50, 30, 38, 43, 26, 30, 38, 46, 37, 43, 55, 29, 31, 31, 33, 34, 32, 25, 25, 40, 29, 34, 26, 30, 26, 30, 38, 29, 46, 30, 28, 26, 28, 61, 21, 44, 30, 30, 28, 66, 34, 40, 25, 44, 30, 27, 34, 24, 42, 57, 28, 23, 49, 34, 55, 28, 36, 33, 34, 26],
        'Age Bin': ['(47.0, 51.0]', '(28.0, 33.0]', '(37.0, 42.0]', '(42.0, 47.0]', '(23.0, 28.0]', '(28.0, 33.0]', '(37.0, 42.0]', '(42.0, 47.0]', '(33.0, 37.0]', '(42.0, 47.0]', '(51.0, 56.0]', '(28.0, 33.0]', '(28.0, 33.0]', '(28.0, 33.0]', '(28.0, 33.0]', '(33.0, 37.0]', '(28.0, 33.0]', '(23.0, 28.0]', '(23.0, 28.0]', '(37.0, 42.0]', '(28.0, 33.0]', '(33.0, 37.0]', '(23.0, 28.0]', '(28.0, 33.0]', '(23.0, 28.0]', '(28.0, 33.0]', '(37.0, 42.0]', '(28.0, 33.0]', '(42.0, 47.0]', '(28.0, 33.0]', '(23.0, 28.0]', '(23.0, 28.0]', '(23.0, 28.0]', '(56.0, 61.0]', '(18.0, 23.0]', '(42.0, 47.0]', '(28.0, 33.0]', '(28.0, 33.0]', '(23.0, 28.0]', '(61.0, 66.0]', '(33.0, 37.0]', '(37.0, 42.0]', '(23.0, 28.0]', '(42.0, 47.0]', '(28.0, 33.0]', '(23.0, 28.0]', '(33.0, 37.0]', '(23.0, 28.0]', '(37.0, 42.0]', '(56.0, 61.0]', '(23.0, 28.0]', '(18.0, 23.0]', '(47.0, 51.0]', '(33.0, 37.0]', '(51.0, 56.0]', '(23.0, 28.0]', '(33.0, 37.0]', '(28.0, 33.0]', '(33.0, 37.0]', '(23.0, 28.0]'],
        'Values': [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
        'Class': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]}

data = pd.DataFrame(data, columns=['Age','Age Bin', 'Values', 'Class'])

fig = plt.figure(figsize=(10,5))
sns.boxplot(x='Age Bin', y="Values", hue='Class', data=data)
plt.xticks(rotation=45)

如果在GWT.getHostPageBaseURL()+ / flags / 16 /处有一些名为US.png,CH.png等的图像,则此方法应该起作用。

https://www.smartclient.com/smartgwt/showcase/#multi_select_combobox_category