Announcement

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

    DynamicForm initialization of value manager

    Hi,
    I updated my SmartClient to version 8.1. And now I have small problem with values manager. When I create new DynamicForm I set valuesManager attribute to string, and I expected that new ValuesManger will be created like before. Canvas.init() call DataBoundComponent.initializeValuesManager(). But now DynamicForm.initWidget() contains this:
    Code:
     if (isc.isA.String(this.valuesManager)) 
        	this.valuesManager = window[this.valuesManager];
    Which remove my String attribute valuesManager, and my value is lost for DataBoundComponent.initializeValuesManager(). So may be something like this will be better:

    Code:
    if (isc.isA.String(this.valuesManager)) {  
        	if(window[this.valuesManager]) {
        		this.valuesManager = window[this.valuesManager];
        	}
        }

    Thanks for your answer.

    #2
    Hi!
    I have exactly same problem like You. I have checked latest SmartClient code (SNAPSHOT_v90d_2013-04-17) and the problem is still there.

    I agree with You that smartclient code is buggy at this place.

    You can use workaround like this:
    Code:
    isc.DynamicForm.addProperties({
    	old_initWidget : isc.DynamicForm.getInstanceProperty("initWidget"),
    	initWidget : function() {
                    if (isc.isA.String(this.valuesManager) && window[this.valuesManager]==null) {
                        isc.ValuesManager.create({
                            ID:this.valuesManager,
                            dataSource:this.dataSource
                        });
                    }
            	this.old_initWidget();
            }
    });
    but cleaner would be of course fixing of DynamicForm.

    Comment


      #3
      And there is the test case which worked well in SmartClient 8.0
      http://www.smartclient.com/docs/8.0/a/b/c/go.html#class..ValuesManager

      but does not work since SmartClient 8.1
      http://www.smartclient.com/docs/8.3/a/b/c/go.html#class..ValuesManager

      Code:
      <!-- The ValuesManager was created automatically before, so it do not have to be instantiated
      <ValuesManager ID="vm"/>
      -->
      <VLayout width="400" height="300" membersMargin="10">
          <members>
              <TabSet ID="theTabs" height="250">
                  <tabs>
                      <tab title="Item">
                          <pane>
                              <DynamicForm ID="form0" valuesManager="vm">
                                  <fields>
                                      <field name="itemName" type="text" title="Item"/>
                                      <field name="description" type="textArea" title="Description"/>
                                      <field name="price" type="float" title="Price" defaultValue="low"/>
                                  </fields>
                              </DynamicForm>
                          </pane>
                      </tab>
                      <tab title="Stock">
                          <pane>
                              <DynamicForm ID="form1" valuesManager="vm">
                                  <fields>
                                      <field name="inStock" type="checkbox" title="In Stock"/>
                                      <field name="nextShipment" type="date" title="Next Shipment"
                                             useTextField="true" defaultValue="256"/>
                                  </fields>
                              </DynamicForm>
                          </pane>
                      </tab>
                  </tabs>
              </TabSet>
          
              <Button title="Submit">
                  <click>
                      vm.validate();
                      if (form1.hasErrors()) theTabs.selectTab(1);
                      else theTabs.selectTab(0);
                  </click>
              </Button>
          </members>
      </VLayout>

      Comment


        #4
        Thanks for the report - we've fixed this in 8.3p and 9.0d - you should be able to remove your workarounds with builds dated April 28 and later

        Comment

        Working...
        X