Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    The getEditValues() method of RowEditorExitEvent is indeed broken. It will be fixed in an upcoming nightly but the call will be changing to getNewValues().

    Comment


      #17
      This has been fixed. RowEditorExitEvent now has a getNewValues() method that returns a Map with key = field name and value = new field value.

      Sanjiv

      Comment


        #18
        Hi David,

        Originally posted by davidj6
        If I read this correctly, returning the new JsObj fixes the hasChanges and therefore results in the correct "update" call on the DataSource.
        No, it is not fixed. The update still was not triggered automatically after returning the new JsObj... even when the hasChanges is true!

        Originally posted by davidj6
        However, to get the correct value saved, you must actually update the in-use value (item.getValue) directly as well.
        There is no item.setValues(JavascriptObject)... so I can't update the item.
        Last edited by bade; 14 Jul 2010, 22:36.

        Comment


          #19
          Hi Sanjiv,

          Thanks for the fix. I will check it out asap.

          Checked it out >> It's probably in the next nightly ;-)

          Regards
          Bart
          Last edited by bade; 15 Jul 2010, 02:38.

          Comment


            #20
            Yes, the fix will be in the next automated build which should be complete in a few hours.

            Comment


              #21
              Bart,

              I'll try to build out a test case here to simulate your environment and see if I can reproduce your situation. In the meantime here is something you can try that will help narrow down the cause.

              Disable validation and retest: setNeverValidate(true). In your last parser, drop the update to the existing JsObj and just return the correct new JsObj.

              Note, the fix Sanjiv posted only fixes the getEditValues() issue in rowEditorExitEvent which is not a cause of your update failure.

              dave

              Comment


                #22
                Hi Dave

                Good news!

                The setNeverValidate(true) indeed fixes the issue of the 'automatic' update not being called! Also, in my update I can see my custom object as I expect it to be (see below).

                The amount coming trough is indeed the newJsObject returned by my parser.
                Subsequent call to DataTools.setProperties works as well!

                To only thing that still isn't happening is the grid being updated with the value from the newJsObject.

                I have another error coming trough, but that might be because of me ;-)

                Code:
                {id=506147, amount={curAmount=1.401298464324817e-45, currencyId=-2147483648, data=[object Object], dataType=7, defaultObject=47.5, defaultValue=47.5, fieldNames=value,mcId,curValue, null=false, numeric=true, refAmount=500, zero=false}}
                Thanx
                Bart

                Comment


                  #23
                  Could you provide your SimpleType definition and your DataSource field definition for this complex field?

                  To only thing that still isn't happening is the grid being updated with the value from the newJsObject.
                  Can you clarify what this means? You are not "seeing" the updated value based on your display formatter? What are you seeing in the grid after edit?

                  Comment


                    #24
                    Hi Dave,

                    After investigation, it was that issue I talked about that was blocking the grid from displaying to correct value.
                    So, my mistake.

                    Just checked with the latest nightly build (15/07), it looks like that Warning you removed is back (see below).

                    Here is the stuff you wanted, need anything more, just yell! Appreciate the help.

                    Regards,
                    Bart

                    Code:
                    public class SilkMCurrency extends SimpleType {
                    	
                    	public final static String SIMPLETYPE_NAME = "silkMCurrency";
                    	
                    	public final static String FIELD_REFAMOUNT = "refAmount";
                    	public final static String FIELD_CURRENCY_ID = "currencyId";
                    	public final static String FIELD_CURAMOUNT = "curAmount";
                    
                    	public SilkMCurrency() {		
                    		super(SIMPLETYPE_NAME, FieldType.TEXT);
                    		this.setNormalDisplayFormatter(new MCurrencyNormalFormatter());
                    		this.setShortDisplayFormatter(new MCurrencyShortFormatter());
                    	}
                    	
                    	@Override
                    	public void setShortDisplayFormatter(SimpleTypeFormatter formatter) {
                    		super.setShortDisplayFormatter(formatter);
                    	}
                    	
                    	@Override
                    	public void setNormalDisplayFormatter(SimpleTypeFormatter formatter) {
                    		super.setNormalDisplayFormatter(formatter);
                    	}
                    
                    }
                    Code:
                    <field sraId="1216" name="amount" title="Amount" type="silkMCurrency" javaClass="parameter.MCurrency" crud="15" required="true" >
                    </field>
                    Code:
                    20100716 12:09:54] 12:09:54.445:ICHG5:WARN:Log:Unrecognized type of value [object Object] returned by the FormItemValueParser::parseValue
                    com.smartgwt.client.core.JsObject$SGWT_WARN: 12:09:54.445:ICHG5:WARN:Log:Unrecognized type of value [object Object] returned by the FormItemValueParser::parseValue
                    	at sun.reflect.GeneratedConstructorAccessor28.newInstance(Unknown Source)
                    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
                    	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                    	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                    	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
                    	at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
                    	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
                    	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
                    	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
                    	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
                    	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
                    	at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
                    	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
                    	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
                    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                    	at java.lang.reflect.Method.invoke(Unknown Source)
                    	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
                    	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                    	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
                    	at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
                    	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
                    	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
                    	at java.lang.Thread.run(Unknown Source)
                    Last edited by bade; 16 Jul 2010, 06:22.

                    Comment


                      #25
                      Any news?!?

                      Comment


                        #26
                        Hi
                        We've been trying to reproduce your issue and have put together a client-only DataSource based test case which should be a valid test.

                        This test case is based around the snippets you've sent us and it should be pretty clear.

                        Essentially
                        - everything is defined in java rather than separate .ds.xml files etc and it's all client-only
                        - the SimpleType definition is basically the same (with one simple formatter)
                        - The TextItem subclass is almost the same, though the formatter / parser functions are slightly different - you'll see the 3 values from the js object show up separated by commas and valid input would be any 3 numeric values separated by commas
                        - There's a datasource with a single record of test data (with a currency field value). The currency type field has the editor type property set to use the custom currency editor.
                        - There's a listGrid bound to the dataSource, showing the single record, and it's set to be editable.

                        I find that the field value can be modified and I see the edited value get picked up correctly and saved as a standard DataSource operation (visible in the RPC tab of the developer console), and the edited value is subsequently formatted correctly in the grid.
                        I also don't see the exception you're getting above with this test case.

                        Can you give this a try against your build and see if you still have issues.
                        If not, we should proceed by seeing what's different about your use case than this test case. The "clientOnly" nature of the dataSource shouldn't be responsible for the problems you're describing, so I would suspect it's to do with the DataSource definition and the ListGrid definition.
                        It might be worth modifying the attached code to bring it closer to what you have in your live app and seeing if you can turn it into a standalone test case that demonstrates the problem that we could run on our end.

                        I'm attaching our test code as a .java file which can be dropped into a project and set as the entry point module with no further modification.
                        Regards
                        Attached Files

                        Comment


                          #27
                          Thanx for the reply... I just quickly glanced at the code and found the following:

                          Code:
                          testGrid.setNeverValidate(true);
                          You are using the workaround as well?!? This should be set to FALSE if you want to reproduce the problem (or call disabled).
                          If I set never validate to true it works. To be complete: just look at David's post of 15th Jul 2010, 06:10 and my next post.

                          CONFIRMED: Just ran your code and if I disable the call to setNeverValidate, I get the same error.
                          Last edited by bade; 18 Aug 2010, 04:24.

                          Comment


                            #28
                            Ah, so the problem you're reporting is that client-side validation is interfering with save when you have this custom parser/formatter.

                            A couple of clarifications:

                            1) I'm testing against the latest nightly LGPL build (http://www.smartclient.com/builds/Sm...GPL/2010-08-18) with the code I attached - if I remove the 'setNeverValidate(true)' setting on this grid I don't get the unrecognized type warning you post below.
                            (However the save does indeed fail).

                            You shouldn't be getting the unrecognized type warning against the latest build - can you re-confirm and if you are still seeing it let us know exactly what build you're working against?

                            2) As noted above, the save is failing when client side validation is enabled for this grid. We'll get to the bottom of this but just to be clear - are you relying on client side validation in your editable grid for this case? I just want to get a sense of whether this is a blocker for you or whether disabling validation is an acceptable workaround in your application for now.

                            Thanks

                            Comment


                              #29
                              The issue here is that the custom SimpleType (SilkMCurrency) inherits from Text and this turns on our standard type-validation logic for strings.
                              This type-validation logic runs on the edited record value - which is correctly parsed from the edited text into a javascript object with several attributes - but doesn't know how to handle it and ultimately causes the edited value not to get saved.

                              You can workaround this by setting 'inheritsFrom' to the string "any" in your simple type:
                              Code:
                              	public SilkMCurrency() { 
                              			super(SIMPLETYPE_NAME,FieldType.TEXT); 
                              			setInheritsFrom("any");
                              			
                              			this.setNormalDisplayFormatter(new MCurrencyFormatter()); 
                              			this.setShortDisplayFormatter(new MCurrencyFormatter()); 
                              		}
                              We'll be adding this as an officially supported field type in the future so you will be able to pass it right into the constructor, but for now this should resolve the issue for you

                              == Update August 23 2010 ==
                              We've now added FieldType.ANY to support this use-case, so you could replace the above lines with
                              Code:
                              super(SIMPLETYPE_NAME,FieldType.ANY);
                              Last edited by Isomorphic; 23 Aug 2010, 15:35.

                              Comment

                              Working...
                              X