wxgrid data types

My data for a PyGridTableBase grid come out of a postgres database,
and many fields are numeric(7,2) or smallint.
The corresponding grid columns have the appropriate cell editors.
After editing a numeric(7,2) cell, the cell shows the two decimal positions, OK.
However, in de underlying data the value of the edited cell is now a string.
Why is this ?
It seems so reasonable that the data type does not change.
And is there a built in mechanism that does the conversion
automa(t|g)ically for me ? Or do i have to write something myself ?
egbert bouwman

···

--
Egbert Bouwman [GMail]

  • Mike
···

On Tuesday, July 3, 2012 8:46:18 AM UTC-5, egbert wrote:

My data for a PyGridTableBase grid come out of a postgres database,

and many fields are numeric(7,2) or smallint.

The corresponding grid columns have the appropriate cell editors.

After editing a numeric(7,2) cell, the cell shows the two decimal positions, OK.

However, in de underlying data the value of the edited cell is now a string.

Why is this ?

It seems so reasonable that the data type does not change.

And is there a built in mechanism that does the conversion

automa(t|g)ically for me ? Or do i have to write something myself ?

egbert bouwman


Egbert Bouwman [GMail]

From my own experience, you get to write it yourself unless someone has created a cool mixin that I’m not aware of.

What exact cell editors are you using? Does your table class implement the methods like Can(G|S)etValueAs and (G|S)etValueAsDouble?

···

On 7/3/12 6:46 AM, Egbert Bouwman wrote:

My data for a PyGridTableBase grid come out of a postgres database,
and many fields are numeric(7,2) or smallint.
The corresponding grid columns have the appropriate cell editors.
After editing a numeric(7,2) cell, the cell shows the two decimal positions, OK.
However, in de underlying data the value of the edited cell is now a string.
Why is this ?
It seems so reasonable that the data type does not change.
And is there a built in mechanism that does the conversion
automa(t|g)ically for me ? Or do i have to write something myself ?
egbert bouwman

--
Robin Dunn
Software Craftsman