I've included the detailed solution in my previous email. I'm attaching it
here in case you cannot find it. Let me know if this can solve the problem.
-M.Y.

Attached content from my previous email:

It's indeed a casting problem. The original data for Object value is in
Number format. So, the data is populated correctly. But when I tried to
change the value in the table, the value type is changed to String. So, the
cast Number fails. This is what I've done to fix the problem.

Instead of:

       Renderer renderer = new Renderer() {
            public String render(Object value, CellMetadata cellMetadata,
Record record, int rowIndex, int colNum, Store store) {
                NumberFormat nf = NumberFormat.getCurrencyFormat();
               return nf.format(((Number) value).doubleValue());
            }
        };

I have to check the value type before the casting:

       Renderer renderer = new Renderer() {
            public String render(Object value, CellMetadata cellMetadata,
Record record, int rowIndex, int colNum, Store store) {
                NumberFormat nf = NumberFormat.getCurrencyFormat();
                Number n;
                String typeOfValue = "";
                String s = "";
                try {
                    if ( value instanceof String) {
                        typeOfValue = "string";
                    } else if ( value instanceof Integer) {
                        typeOfValue = "integer";
                    } else if ( value instanceof Float) {
                        typeOfValue = "float";
                    } else if ( value instanceof Double) {
                        typeOfValue = "double";
                    }
                    if ( typeOfValue.indexOf("string") >= 0) {
                        n = (Number) Float.parseFloat((String) value);
                    } else {
                        n = (Number) value;
                    }
                    s = nf.format(n.doubleValue());
                    System.out.println("value is " + s);
                } catch ( Exception e) {
                    System.out.println("Error happened " + e + " and
typeOfValue is " + typeOfValue);
                }
                return s;
            }
        };


On Fri, Oct 9, 2009 at 1:53 AM, Chints <[email protected]> wrote:

>
> SAme Problem please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> On Oct 8, 1:27 am, my600080 <[email protected]> wrote:
> > I'm using Eclipse Galileo, GWT 1.7 and GWT-EXT 2.0.6. I copied the
> > Charts samples into my workspace. Everything works ok except that when
> > I tried to update the values in the Grid for any of the charts, the
> > change reverses back right away to the old value. Is this something
> > that anyone else has experienced as well? Or is it just me? Thanks!
> >
> > M.Y.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to