Announcement

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

    SGWT.mobile - SelectItem forced to scroll or touch to activate value

    Hi,

    When selecting a value with a selectItem for a field in a dynamicForm that has no value assigned yet, if the value presented by default by the selectItem is the desired one, one would just press "Done" and don't scroll or even touch the cylinder. The problem in such case is that no value is returned to the field. One has to at least touch or scroll the cylinder for any value to be returned. So, the workaround if the desired value is the one presented when selectItem opens is to scroll up and then down to the "activate" the value.

    Thanks, Ben.

    #2
    This is now fixed for tomorrow's build.

    Comment


      #3
      Not really working in 2013-01-25.

      Scenario. Use an empty field edited by a picklist. Click on the field to open the picklist. Don't select any value in the list, suppose the one the list opens on is the desired one, then just click "Done". This should return the value but it still returns nothing to the field.

      Comment


        #4
        This issue too has now been fixed for tomorrow's build.

        Comment


          #5
          Tested in 2013-01-28, not quite fixed.

          Comment


            #6
            Could you elaborate a bit - are you seeing the exact same bad behavior, or something new?

            Comment


              #7
              Exact same behavior, as described in the "Scenario" in previous post. I insist, this is happening only under these conditions (which happen frequently):

              - field is empty initially
              - value presented in the picklist is by chance the desired one in which case one would even not touch the list and press "Done" directly, expecting that the presented value would be returned to the field, which is unfortunately still not the case

              Comment


                #8
                Something must be subtly different about our test vs yours. Can you post some code that can be used to reproduce the problem?

                Comment


                  #9
                  It was subtle indeed, took my 3 hours to isolate the exact situation in a simple code. Here it is:

                  After first record is loaded (Marc), press "Add" button. On the new empty record, select "Title", keep the first choice 'Mr.", don't touch the dial, just press "Done". That is where you would expect Mr. to be returned but it is not. Something is returned only if you play a little bit with the dial.

                  Good luck.

                  Code:
                  package com.nside.test.client;
                  
                  import java.util.HashMap;
                  
                  import com.google.gwt.user.client.ui.RootLayoutPanel;
                  import com.smartgwt.mobile.client.cordova.CordovaEntryPoint;
                  import com.smartgwt.mobile.client.data.DataSource;
                  import com.smartgwt.mobile.client.data.DataSourceField;
                  import com.smartgwt.mobile.client.widgets.Action;
                  import com.smartgwt.mobile.client.widgets.ActionContext;
                  import com.smartgwt.mobile.client.widgets.ScrollablePanel;
                  import com.smartgwt.mobile.client.widgets.form.DynamicForm;
                  import com.smartgwt.mobile.client.widgets.form.fields.SelectItem;
                  import com.smartgwt.mobile.client.widgets.form.fields.TextItem;
                  import com.smartgwt.mobile.client.widgets.layout.NavStack;
                  
                  public class Test extends CordovaEntryPoint {
                  
                      public Test() {
                  	}
                  
                      public void onDeviceReady() {
                  
                      	NavStack navStack = new NavStack();
                      	RootLayoutPanel.get().add(navStack);
                      	ScrollablePanel panel1 = new ScrollablePanel("Panel 1");
                      	final DynamicForm form = new DynamicForm();
                      	panel1.addMember(form);
                  
                      	panel1.setActions(new Action("Add"){
                  			@SuppressWarnings("unchecked")
                  			public void execute(ActionContext context) {
                  		    	HashMap initialValues = new HashMap<String,Object>();
                  		    	form.editNewRecord(initialValues); //using empty initial value because editNewRecord() ith no argument leads to stackoverflow
                  			}
                      	});
                      	
                      	final DataSource personsDS = new DataSource("personsDS");
                          personsDS.setFetchDataURL("/sampleResponses/persons");
                          personsDS.setFields(new DataSourceField("id", "integer"), new DataSourceField("name", "text"), new DataSourceField("id_title", "integer"));
                  
                          final DataSource titlesDS = new DataSource("titlesDS");
                          titlesDS.setFetchDataURL("/sampleResponses/titles");
                          titlesDS.setFields(new DataSourceField("id", "integer"), new DataSourceField("name", "text"));
                  
                      	form.setDataSource(personsDS);
                      	TextItem nameItem = new TextItem("name","Name","Enter text ...");
                          SelectItem titleItem = new SelectItem("id_title","Title","Select ...");
                          titleItem.setOptionDataSource(titlesDS);
                          titleItem.setValueField("id");
                          titleItem.setDisplayField("name");
                          titleItem.fetchData();
                          form.setFields(nameItem,titleItem);
                  
                          form.fetchData();
                      	navStack.push(panel1);
                  
                      	
                  	}
                  	
                  }

                  The DS.responses :

                  persons
                  Code:
                  {
                      "response": {
                          "status": 0,
                          "startRow": 0,
                          "endRow": 0,
                          "totalRows": 1,
                          "data": [
                          {
                              "id": 1,
                              "name": "Marc",
                              "id_title": 1
                          }
                          ]
                      }
                  }
                  titles
                  Code:
                  {
                      "response": {
                          "status": 0,
                          "startRow": 0,
                          "endRow": 3,
                          "totalRows": 4,
                          "data": [
                          {
                              "id": 1,
                              "name": "Mr."
                          },
                          {
                              "id": 2,
                              "name": "Ms."
                          },
                          {
                              "id": 3,
                              "name": "Dr."
                          },
                          {
                              "id": 4,
                              "name": "Prof."
                          }
                          ]
                      }
                  }
                  Last edited by bda@n-side.com; 9 Feb 2013, 14:30.

                  Comment


                    #10
                    This should now be fixed in today's build.

                    Comment


                      #11
                      Works fine now, thanks

                      Comment

                      Working...
                      X