On 11/22/2013 02:45 PM, Ricardo Aráoz wrote:
I'm learning to work with the datanav.
I'm modifying one of the CRUDs created by the AppWizard. My file has a
foreign key that I wish the user to see as a drop down list, so I
change the input control to a dDropdownList with ValueMode='Key'. I
would usually set right there the Choices and Keys, and get done with
it. But this control must be different, if a value has already been
referenced by a foreign key in some other row of the actual table it
must not appear in the drop down, unless it is the value that is being
referenced in the actual row.
To make it easier to understand, the Choices and Keys of the drop down
list must come from the following :
crs.execute("""select Id, trim(Nombre||" "||Apellido) as
FullName
from persona
where Id not in (select PersonaId
from proveedor)
or Id = ?
order by FullName""",
(self.Record.Id , ))
where self.Record.Id is the actual row.
I have everything set and working but I am not being able to place
Choices and Keys assignment in a proper place. I've tried binding the
RowNumChanged event to the method that sets the Choices and Keys, but
this event occurs AFTER the controls are updated, so when I move the
pointer I get a value error when the framework tries to set the drop
down's Value to a foreign key that does not exist the actual choices
(the choices appropriate for the previous record).
I've also tried binding the drop down's Update event to this method
with the same results.
Has anybody done something similar? Any suggestions?
I've had this problem a lot. I want some action to occur, in sequence,
that responds to an event. I needed the data to change for a dropdown
whenever the state changed in a different dropdown (listed all the
states). There is a tutorial of some sort on the Dabo website but it
didn't work for me. What I ended up doing was playing with
"dabo.ui.callAfterInterval" and the "dabo.ui.callAfter" methods and
between the two was able to force the order of the actions. I tried
setting up a main form method to control the order of actions but that
only partially worked. My best suggestion is to work what I suggested
and see if you get the order and timing to satisfy your needs. Other's
may have had better results.
Johnf
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/528ff955.8060...@jfcomputer.com