Announcement

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

    DynamicForm's are not picking up the dataPath of a parent Canvas.

    I'm using: SmartClient Version: SNAPSHOT_v12.1d_2019-11-02/PowerEdition Deployment (built 2019-11-02) and the latest documentation: https://www.smartclient.com/smartgwtee-release/javadoc/

    In the documentation for Canvas.getDataPath() there are three example blocks of code. The last one entitled "dataPaths from multiple nested components may also be combined" exemplifies a bug I've been tearing my hair out over. form3 should combine the dataPath from the innerlayout so that it's companyNameField1 StaticTextItem displays the companyName for the parentCompany, "Some Corperation". Instead, it is displaying the companyName of the root map, "Some Company". Evaluating the JS Expression "isc_DynamicForm_1.getFullDataPath()" yeilds "/". Based on the documentation, I would expect it to be "parentCompany/companyName".

    I need this to complete a fairly complicated and multiply nested UI that has been designed to use the ValuesManager and dataPaths. If this has been solved in a later version, I couldn't find a post.

    Here is the code for quick reference.

    Code:
            ValuesManager vm = new ValuesManager();
    
            Map values = new HashMap();
            values.put("companyName", "Some company");
            Map addressMap = new HashMap();
            addressMap.put("street", "123 Main Street");
            addressMap.put("city", "New York");
            addressMap.put("state", "NY");
            values.put("address", addressMap);
    
            Map values1 = new HashMap();
            values1.put("companyName", "Some Corporation");
            Map addressMap1 = new HashMap();
            addressMap1.put("street", "1 High Street");
            addressMap1.put("city", "New York");
            addressMap1.put("state", "NY");
            values1.put("address", addressMap1);
            values.put("parentCompany", values1);
    
            vm.setValues(values);
            Layout layout = new Layout();
            layout.setValuesManager(vm);
    
            DynamicForm form = new DynamicForm();
            form.setDataPath("/");  
            TextItem companyNameField = new TextItem("companyName");
            form.setItems(companyNameField);
    
            DynamicForm form1 = new DynamicForm();
            form1.setDataPath("address");  
            TextItem streetField = new TextItem("street");
            TextItem cityField = new TextItem("city");
            TextItem stateField = new TextItem("state");
            form1.setItems(streetField, cityField, stateField);
    
            Layout innerlayout = new Layout();
            innerlayout.setBorder("2px solid blue"); // debug
            innerlayout.setDataPath("parentCompany");
    
            DynamicForm form3 = new DynamicForm();
            form3.setDataPath("/");  
            StaticTextItem companyNameField1 = new StaticTextItem("companyName");
            form3.setItems(companyNameField1);
    
            DetailViewer detailViewer = new DetailViewer();
            detailViewer.setDataPath("address");  
            DetailViewerField streetDVField = new DetailViewerField("street");
            DetailViewerField cityDVField = new DetailViewerField("city");
            DetailViewerField stateDVField = new DetailViewerField("state");
            detailViewer.setFields(streetDVField, cityDVField, stateDVField);
    
            innerlayout.addMember(form3);
            innerlayout.addMember(detailViewer);
    
            layout.addMember(form);
            layout.addMember(form1);
            layout.addMember(innerlayout);

    #2
    Thanks for the notification and clear test case.
    We agree that this looks like it should work.
    We have a developer taking a look, but in the meantime, a quick fix at the application level is to call 'setDataPath()' after the component has been drawn instead of calling it when first initializing the form

    Regards
    Isomorphic Software

    Comment


      #3
      Hello
      This is a follow up from the development team - the suggested solution here - calling setDatapath() after draw - is not going to resolve this issue for you. We apologize for the confusion.
      A temporary solution that will work with the existing code is to set the datapath on form3 to "/parentCompany" .

      However we are actively looking at this, and will be following up soon with more information on this issue

      Regards
      Isomorphic Software

      Comment


        #4
        We have implemented a fix for this issue, whereby setting the dataPath for form3 to "" (the empty string) will give the behavior you desire. This is now the general way to specify that an element and its children should participate in dataPath, but without the element itself contributing anything additional to the dataPath. We have also added a section to the documentation for Canvas.getDataPath() explaining this.

        The change will be in 12.1d builds from today onwards (ie, those dated 18 February and later).

        Regards,
        Isomorphic Software

        Comment

        Working...
        X