On Sat, Dec 12, 2009 at 12:01 AM, Emanuele Gesuato
<[email protected]> wrote:
> Hi,
>
> Thanks for the previous response, it is great for an open source
> project having such great support.
>
> I've two unrelated question.
>
> 1. I've a form and a grid in a single panel. When the user selects a
> record in the grid the form changes its content to the
> content of the selected record which is fine. For anyone who is
> interested now the combobox (that shows values from a joined table)
> has a correct behaviour. But if i change a value on the form and
> select another record in the grid the old row gets the new value and
> for the
> user it seems that the value is saved in db which is not. I would like
> to show in the grid only the persisted data, so the grid and the dform
> should be related in only one way (records in the grid should be
> displayed in the form but not viceversa). Is there a way to accomplish
> this ?
Yes. There are several ways.
The important thing is that you understand that both the grid and the
fields on the form are getting their data from the same datasource.
Usually this datasource is a bizobj (I guess that's your case). So
changing any value in any widget will change the underlying bizobj
(not the db table) and naturally all widgets displaying data from the
same datasource and record will reflect the change. This is provided
by the framework and is useful.
My advice would be to have the fields linked to the bizobj, but have
the grid linked to a dataset. Get the dataset by calling the
bizobj.getDataSet() method. Set the grid DataSet property to the
dataset. Now changes made to the form will be pending save on the
bizobj, but will not affect the dataSet (the dataSet is just an
independent copy of the record in the bizobj).
Of course you loose synchronicity. That is, if you issue a save the
grid will not update (you'll have to get a new dataset and set it to
the grid , perhaps in the form's afterSave() method.
> 2. I have a table with only a field and i would like to let the user
> enter values using an editable combobox. But i need to give crud
> capabilities to this component. So the user CREATE a new record only
> if the previous value of the combo was empty, UPDATE a
> record only if previous value and the new value are different from
> empty and DELETE a record only if new value is empty and previous
> value are not empty. Previous value is the "choice" from the combobox
> originally present (previous to the user operation) and the new value
> is the "choice" after the user press ENTER. Do you think it is
> approachable as idea ? Or it is better to have a more traditionally
> way ?
This seems very confusing for the user. But you can certainly
accomplish this. Perhaps in the bizobj.afterPointerMove() method you
can capture the initial value ("", None or value) and then in another
method you can decide which crud action to apply.
> As i started writing another question come to mind: why "messages" are
> not localized in external files ? I've seen many alert/error message
> written directly in python that are not so easy to localize in
> different languages.
I haven't dealt with this. Perhaps someone else in the list can help.
Miguel
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]