[ 2610044 ] Can't save Shipments
- reset zero to null if it is not in list
This commit is contained in:
parent
3d55c83dd0
commit
05730e876e
|
@ -99,6 +99,23 @@ public class Combobox extends org.zkoss.zul.Combobox
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isSelected(Object value)
|
||||
{
|
||||
if (value == null)
|
||||
return false;
|
||||
|
||||
Comboitem item = getSelectedItem();
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
return item.getValue().equals(value);
|
||||
}
|
||||
|
||||
/** Returns RS_NO_WIDTH|RS_NO_HEIGHT.
|
||||
*/
|
||||
protected int getRealStyleFlags() {
|
||||
|
|
|
@ -179,23 +179,41 @@ ContextMenuListener, IZoomableEditor
|
|||
{
|
||||
if (value != null && (value instanceof Integer || value instanceof String))
|
||||
{
|
||||
getComponent().setValue(value);
|
||||
|
||||
if (getComponent().getSelectedIndex() == -1 && lookup != null)
|
||||
getComponent().setValue(value);
|
||||
if (!getComponent().isSelected(value))
|
||||
{
|
||||
if (isReadWrite())
|
||||
if (isReadWrite() && lookup != null)
|
||||
lookup.refresh();
|
||||
Object curValue = oldValue;
|
||||
oldValue = value;
|
||||
refreshList();
|
||||
|
||||
//still not in list, reset to zero
|
||||
if (!getComponent().isSelected(value))
|
||||
{
|
||||
if (value instanceof Integer && (Integer)value == 0)
|
||||
{
|
||||
getComponent().setValue(null);
|
||||
if (curValue == null)
|
||||
curValue = value;
|
||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
|
||||
super.fireValueChange(changeEvent);
|
||||
oldValue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oldValue = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getComponent().setValue(null);
|
||||
}
|
||||
|
||||
oldValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Combobox getComponent() {
|
||||
|
|
Loading…
Reference in New Issue