DynamicForm.dataSource makes useless request

Hi,

I have DynamicForm with a dataSource assigned to it. This is mainly to use the field definitions from the Datasource definition. The values are filled into the form with dataSource.fetchData();dynamicForm.setValues(). What happens now ist that I now have two dsRequests to the server. When I remove DynamicForm.dataSource the behaviour is 1 request as expected, but I whould miss the field definitions in this case.

Is there a solution for that problem?

Thanks, Bruno

Hi Bruno,

A DynamicForm bound to a dataSource will not ordinarily issue requests on it’s own - you can verify this by binding a DynamicForm to any example DataSource in the SDK. If you are seeing requests you didn’t initiate, please provide a test case.

Testcase

Thanks. The ‘normal’ case works as excpected. But with this example I can see an unexpected dsRequest.

<%@  page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic"%>
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <title>Test</title>

  <script>
   window.isc_useSimpleNames = false;
  </script>

  <isomorphic:loadISC skin="SmartClient" />
  <script>
   isc.RPCManager.actionURL = isc.Page.getAppDir() + "/masoft/IDACall";
   isc.RPCManager.showPrompt = false;
  </script>

 </head>
 <body>
  <script>
testds = isc.DataSource.create({
   ID:"testds",
   addGlobalId:false,
   dropExtraFields:true,
   fields:[
      {name:"fullName", type:"text", canEdit:false},
      {name:"businessFullName", type:"text", canEdit:false},
      {name:"locale", type:"enum", valueMap:{"0":"Englisch","1":"Deutsch"}},
      {name:"principalName", type:"text", canEdit:false},
      {name:"businessCity", type:"text", canEdit:false},
      {name:"role", type:"enum"},
      {name:"userRoles", hidden:true, multiple:true}
   ]
});  
   
createHeaderForm = function(){
  var theForm;
  theForm = isc.DynamicForm.create({
      autoDraw:false,
      canFocus:false,
      numCols:6,
      cellPadding:2,
      overflow:"visible",
      colWidths:[200,100,"*",30,80,80],
      dataSource: testds,
      fields:[
         {editorType:isc.SpacerItem,colSpan:5},
         {editorType:isc.ButtonItem, startRow:false, align:"right", title:"logoff", shouldSaveValue:false},
         {editorType:isc.HeaderItem,defaultValue:"sie sind angemeldet als:", endRow:false, shouldSaveValue:false},
         {editorType:isc.StaticTextItem, name:"fullName", colSpan:2},
         {editorType:isc.StaticTextItem, name:"principalName", align:"right", endRow:true},
         {editorType:isc.SpacerItem},
         {editorType:isc.StaticTextItem, name:"businessFullName"},
         {editorType:isc.StaticTextItem, name:"businessCity"},
         {name:"role", showTitle:false, align:"right"},
         {editorType:isc.SpacerItem},
         {name:"locale", showTitle:false, align:"right"}
       ],
      width:"100%"
   });  
   return theForm; 
}   
   

myPageHeader = isc.defineClass("msgPageHeader", isc.HLayout);
myPageHeader.addProperties({
   initWidget:function(args){
      this.Super("initWidget",args);
      myHeaderForm = createHeaderForm();
      this.addMember(myHeaderForm);
   },
   backgroundImage:"[SKIN]logo.jpg",
   backgroundRepeat:"no-repeat",
   autoDraw:false,
   styleName:"pageHeader",
   height:10,width:"100%",
   overflow:"visible",
   showShadow:true,
   shadowDepth:5,
   shadowOffset:0
});
   
page = myPageHeader.create();
page.show();   
 </script>

 </body>
</html>

Hi Bruno,

This is happening because you have declared a field “role” as type “enum” but not provided a valueMap. SmartClient then assumes the valueMap must be server-derived based on a fetch against the “testDS” DataSource.

thanks

I have set autoFetchData:false for this enum because I will set the valueMap when I retrieve data for this form. Thanks.