问题描述
我正在尝试将下拉框小部件转换为 SuggestionBox,因为当前的下拉菜单有 100 多个选项.不过,您似乎只能向 SuggestOracle 添加字符串建议.我需要能够添加一个自定义对象,该对象同时包含一个描述和一个 ID,该 ID 将记录与数据库相匹配.我是否必须扩展 SuggestOracle 类?
I'm trying to convert a drop down box widget into a SuggestionBox because the current drop down menu has 100+ choices. It seems like you can only add String suggestions to a SuggestOracle though. I need to be able to add a custom object that contains both a description and an ID that matches the record to the database though. Would I have to extend the SuggestOracle class?
推荐答案
是的,我知道您不能使用值对,即 Id 和 Value.您必须在建议框中添加字符串,也许您可以使用建议框以外的其他解决方案,即创建值列表弹出窗口.并添加任意数量的字段.在带有分页的 flex 表中显示您的数据.使用选择处理程序使用所选行更新您的表单.有关如何使用 FlexTable 和处理事件的参考,请参阅 able Single Row Click Event
Yes as i know you can not use pair of values i.e Id and Value. You have to add your strings in suggestion box perhaps you can use different solution other then suggestion box i.e. Create a List of values popup. And add as many fields as you like. display your data in flex table with pagination. update your form with the selected row by using selecition handler. for reference how to use FlexTable and handle events please see able Single Row Click Event
SuggestOracle
是您已经使用的 MultiWordSuggestOracle
的父类.
SuggestOracle
is the parent class of MultiWordSuggestOracle
which you are already yousing.
public class MultiWordSuggestOracle extends SuggestOracle
这篇关于使用自定义对象建议创建 GWT SuggestOracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!