isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik de Hair <e.deh...@pocos.nl>
Subject Reset dependant choice
Date Mon, 02 Mar 2015 13:02:34 GMT
Hi,

I have 2 selectfields (A and B) where the elements of B depend on A, and 
I have the following scenario:

1. Select an option at A
   (choices for B are set now but no current selection at B)
2. Select an option at B
3. Select another option at A for which the current selection at B is 
not valid
   (Now the first option of the (changed) possible choices of B is 
selected while I didn't select this option)

The ReferencePanel has the following code:

// called by setProviderAndCurrAndPending
     private void resetIfCurrentNotInChoices(final 
Select2Choice<ObjectAdapterMemento> select2Field, final 
List<ObjectAdapterMemento> choiceMementos) {
        ...
         if(!curr.containedIn(choiceMementos)) {
             if(!choiceMementos.isEmpty()) {
                 final ObjectAdapterMemento newAdapterMemento = 
choiceMementos.get(0);
select2Field.getModel().setObject(newAdapterMemento);
getModel().setObject(newAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK));
             } else {
                 select2Field.getModel().setObject(null);
                 getModel().setObject(null);
             }
         }
         ...
     }

Is there any use of setting the selected option to the first item of the 
choices? It seems a bit strange from the user's perspective.

I can reset it in my code but maybe this scenario isn't desirable for 
any Isis application.

Erik

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message