Announcement

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

    Form SelectItem Question

    SmartGwt 3.0p 1-30-2012
    GWT 2.4
    Firefox 6.0

    I am somewhat confused and hopefully someone can point out something that I am doing wrong and/or missing.

    I have a StackSection with a DynamicForm as a control for that Section.


    Within the DynamicForm, I have a SelectItem which I am trying to perform a particular fetch operation for and it is not working for me.

    Code:
    final DataSource projectAssignDS = DataSource.get("ProjectAssignments");
    
            DynamicForm pForm = new DynamicForm();
           	pForm.setDataSource(projectAssignsDS);
           	pForm.setFetchOperation("fetch_user_projects");
            pForm.setUseAllDataSourceFields(false);
            
            SelectItem project = new SelectItem("ProjectId");
            project.setTitle("<b><font color=\"#FFFF00\">Current Project</font></b>");
            project.setWidth(400);
            pForm.setFields(project);
    ProjectAssignments.ds.xml file
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <DataSource ID="ProjectAssignments" dbName="manifest"
    	serverType="sql" tableName="project_assignments">
    	<fields>
    		<field name="AssignmentId" type="sequence" primaryKey="true"  />
    		<field name="UserId" title="User" type="integer" foreignKey="Users.UserId" required="true" />
    		<field name="ProjectId" title="Project" type="integer" foreignKey="Projects.ProjectId" required="true" />
    	</fields>
    	
    	<operationBindings> 
    		<operationBinding operationType="fetch" operationId="fetch_user_projects">
    			<selectClause>ProjectId</selectClause>
    			<tableClause>project_assignments</tableClause>
    			<whereClause>UserId=$values.UserId</whereClause>
    		</operationBinding>
    	</operationBindings>
    </DataSource>
    LOG
    Code:
    === 2012-01-30 21:15:52,328 [80-4] DEBUG RPCManager - Request #1 (DSRequest) pay
    load: {
        criteria:{
            ProjectId:"<b><font color=\"#FF0000\">Please Select Your Project</font><
    /b>"
        },
        operationConfig:{
            dataSource:"Projects",
            operationType:"fetch"
        },
        componentId:"isc_DynamicForm_2",
        appID:"builtinApplication",
        operation:"Projects_fetch",
        oldValues:{
            ProjectId:"<b><font color=\"#FF0000\">Please Select Your Project</font><
    /b>"
        }
    }
    The log shows the default "fetch" operation is being used and from the "Projects" dataSource instead of the "ProjectAssignments" datasource.

    Any reason why its using my Projects datasource instead of the ProjectAssignments datasource?

    Also, what is the reason why its not using the "fetch_user_projects" which I am setting with "pForm.setFetchOperation()"?
Working...
X