Announcement

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

    ValuesManager: Custom operation and saveData not receiving the changed values

    SmartClient Version: SC_SNAPSHOT-2010-08-03/EVAL Deployment (expires 2010.10.02_09.35.33) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

    Hi,

    When I call my custom operation, the changed values are not in the Map given to the operation.

    Initial data is fetched, I then add a conditionValue on one of the condition items (contained in a listgrid); I then click search which calls the custom operation.

    If I do the same, but call the save operation instead of my custom operation, I have the same problem, the changed values are not coming trough!!!

    Custom operation on the serverObject:
    Code:
    public DSResponse performSearch(DSRequest dsRequest, Map record) 
      throws Exception
    { 
    ...
    }
    Client code
    Code:
    valueMgr = new ValuesManager();
    this.setValuesManager(valueMgr);
    		
    valueMgr.setDataSource(ds);
    
    
    selection = new DynamicForm();
    selection.setWidth("50%");
    selection.setHeight(250);
    selection.setNumCols(4);
    selection.setValuesManager(valueMgr);
    selection.setDataPath(SearchSessDTOFields.SELECTION);
    selection.setDataSource(SilkDataSourceNames.SELECTION);
    				
    conditions = new ListGrid();		
    conditions.setWidth("50%");
    conditions.setHeight(250);
    conditions.setValuesManager(valueMgr);
    conditions.setDataPath(SearchSessDTOFields.CONDITIONITEMS);
    conditions.setDataSource(SilkDataSourceNames.CONDITIONITEMS);
    conditions.setAutoFetchData(false);
    conditions.setCanEdit(true);
    conditions.setSaveByCell(false);
    conditions.setAutoSaveEdits(false);
    conditions.setSelectOnEdit(true);
    		
    displayitems = new ListGrid();	
    displayitems.setVisible(false);
    displayitems.setValuesManager(valueMgr);
    displayitems.setDataPath(SearchSessDTOFields.DISPLAYITEMS);
    displayitems.setDataSource(SilkDataSourceNames.DISPLAYITEM);
    displayitems.setAutoFetchData(false);
    displayitems.setCanEdit(true);
    displayitems.setSaveByCell(false);
    displayitems.setAutoSaveEdits(false);
    displayitems.setSelectOnEdit(true);
    
    ...
    
    public void onClick(ClickEvent event) {
    ...
      if(tooltip.equals("Save")){
        valueMgr.saveData();
      } 
      else if(tooltip.equals("Search")){
        executeOperation(ISearchOutpost.performSearch);
      }
    }
    
    
    	private void executeOperation(final String operationId) {
    		DSRequest requestProperties = new DSRequest();
    		Record record = new Record(JSOHelper.convertMapToJavascriptObject(valueMgr.getValues()));
    			
    		datasource.performCustomOperation(operationId, record, new DSCallback() {
    			
    			public void execute(DSResponse response, Object rawData, DSRequest request) {
    				//clear previous values
    				searchResult.setData(new ListGridRecord[0]);
    				
    				JavaScriptObject resultSet = (JavaScriptObject) rawData;		
    				searchResult.setData(Record.convertToRecordArray(resultSet));
    //				searchResult.redraw();
    			}
    		}, requestProperties);		
    	}
    ds.xml
    Code:
    <DataSource ID="SearchSessDTO" dropExtraFields="true">
    <fields>
    <field name="selection" type="93" javaClass="outpost.dto.selection.SelectionDTO" multiple="true" />
    <field name="conditionItems" type="92" javaClass="outpost.dto.selection.ConditionItemDTO" multiple="true" />
    <field name="displayItems" type="91" javaClass="outpost.dto.selection.DisplayItemDTO" multiple="true" />
    </fields>
    <serverObject ID="SearchSessStore" lookupStyle="new" className="server.stores.search.SearchSessStore"/>
    <operationBindings>
    	<binding operationId="ISearchOutpost.performSearch" operationType="custom" serverMethod="performSearch"/>
    	<binding operationId="ISearchOutpost.generateNewInstance" operationType="fetch" serverMethod="generateNewInstance"/>
    </operationBindings>
    </DataSource>
    the traces from the DEV Console where > 20 kb, so I am unable to post these as attachments

    #2
    At what point are you saying the values are missing? If you inspect he Map riggt before your call to performCustomOperation(), are the values there? What if you look in the RPC tab of the Developer Console?

    Comment


      #3
      The changed values are not appearing in the arguments of my operations on the serverobject. When I inspect the argument of either call (custom or update) the map doesn't contain the changed values.

      Driving to work this morning, it flashed in my head that I was missing a primaryKey for my "main" datasource. So, I added one today (type sequence). But it doesn't make any difference.

      The values don't appear in the RPC tab either. I have uploaded the most important part of the RPC call (it's too big otherwise).

      Code:
      <DataSource ID="SearchSessDTO" dropExtraFields="true">
      <fields>
      <field primaryKey="true" name="id" hidden="true" type="sequence" />
      <field name="selection" type="93" javaClass="outpost.dto.selection.SelectionDTO" multiple="true" />
      <field name="conditionItems" type="92" javaClass="outpost.dto.selection.ConditionItemDTO" multiple="true" />
      <field name="displayItems" type="91" javaClass="outpost.dto.selection.DisplayItemDTO" multiple="true" />
      </fields>
      <serverObject ID="SearchSessStore" lookupStyle="new" className="server.stores.search.SearchSessStore"/>
      <operationBindings>
      	<binding operationId="ISearchOutpost.performSearch" operationType="custom" serverMethod="performSearch"/>
      	<binding operationId="ISearchOutpost.generateNewInstance" operationType="fetch" serverMethod="generateNewInstance"/>
      </operationBindings>
      </DataSource>
      Attached Files

      Comment


        #4
        What about if you inspect the Map right before your call to performCustomOperation() (client-side).

        Comment

        Working...
        X