我正在使用 Wicket 和 ajax 框架。下拉菜单通过检票口填充onchnage
,下拉菜单通过ajax
.
当用户从下拉列表中选择值时,我想title
在下拉列表中添加动态。
代码如下:
DropDownChoice attrDDC = new DropDownChoice("dropDownField",
new PropertyModel(this, "modelObject"),
entityList,
new ChoiceRenderer(element.getEntity().getNameField()));
attrDDC.setNullValid(true);
attrDDC.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (getModelObject() != null)
nodeAttribute.setIdCodeValue(getModelObject().getId());
else
nodeAttribute.setIdCodeValue(null);
// thisDDC.add(new AttributeAppender("onmouseover",
new Model("Tip('" + ((WorkflowRules)getModelObject()).getRuleName() + "');"), ";"));
// thisDDC.add(new AttributeModifier("title", true, new Model(((WorkflowRules)getModelObject()).getRuleName())));
if (elmntIdDDCMap != null && elmntIdDDCMap.containsKey(thisElmnt.getId()))
{
List<DropDownChoicePanel> ddcPanelList = elmntIdDDCMap.get(thisElmnt.getId());
for (DropDownChoicePanel ddcPanel : ddcPanelList)
{
ddcPanel.setEntityList(attributesList);
target.addComponent(ddcPanel.getThisDDC());
}
}
}
});
add(attrDDC);
thisDDC = attrDDC;
PS:注释行是我尝试过的行。