Announcement

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

    ISC_DataBinding JavaScriptException (SelectString Not Function)

    All:

    I am seeing a JavaScript exception when I'm using the SelectItem.setPickListFilterCriteriaFunction. It seems to happen when I'm using a DataSource that is client-only and has the setCacheAllData set to true.

    Here's a partial listing of my DataSource:
    Code:
    public class ListSource extends RestDataSource {
    
            private static ListSource instance = null;
    	private static RestDataSource cachedInstance = null;
    	
    	public static ListSource getInstance(){
    		if(instance == null){
    								
    			instance = new ListSource("DBList_DS");							
    						
    			instance.fetchData(new Criteria(),new DSCallback(){
    				
    				@Override
    				public void execute(DSResponse response, Object rawData,
    						DSRequest request) {
    					
    					cachedInstance = new RestDataSource();
    					cachedInstance.setClientOnly(true);
    					cachedInstance.setCacheAllData(true);
    					cachedInstance.setInheritsFrom(instance);
    					cachedInstance.setCacheData(response.getData());
    					
    				}
    				
    			});
    			
    		}
    		
    		return instance;
    	}
    	
    	public static RestDataSource getCachedInstance(){
    		return cachedInstance;
    	}
    }

    Here's some example code for the SelectItem:
    Code:
    _methodBox = new SelectItem();
    _methodBox.setTitle("Method");
    _methodBox.setWidth(200);
    _methodBox.setValueField("id");
    _methodBox.setDisplayField("description");
    _methodBox.setOptionDataSource(ListSource.getCachedInstance());
    _methodBox.setPickListFilterCriteriaFunction(new FilterCriteriaFunction()
    {
    
    	@Override
    	public Criteria getCriteria() {
    		Criteria c = new Criteria();
    				c.addCriteria("attributeID",Utils.LIST_PAYMENT_RECEIVED_TYPES);
    				return c;
    	}
    			
    });
    Code:
    com.google.gwt.core.client.JavaScriptException: (TypeError): _3.selectString is not a function
     fileName: http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js
     lineNumber: 2058
     stack: isc_RestDataSource_transformResponse([object Object],[object Object],[object Object])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:2058
    ([object GWTJavaObject],[object GWTJavaObject],[object Object])@http://localhost:9995:292
    @:0
    ([object GWTJavaObject],4456667,[object GWTJavaObject],[object GWTJavaObject],[object Object])@http://localhost:9995/myprogram/myprogram/hosted.html?myprogram:56
    ([object Object],[object Object],[object Object])@http://localhost:9995:84
    ((function (dsResponse, dsRequest, data) {var jObj = this.__ref;if (jObj === undefined) {jObj = $wnd.isc.DS.get(this.inheritsFrom).__ref;}var responseJ = __gwt_makeJavaInvoke(1)(null, 4522065, dsResponse);var requestJ = __gwt_makeJavaInvoke(1)(null, 4587641, dsRequest);__gwt_makeJavaInvoke(3)(jObj, 4456667, responseJ, requestJ, data);}),[object Object],[object Object])@http://localhost:9995:32
    @:0
    (null,65563,(function (dsResponse, dsRequest, data) {var jObj = this.__ref;if (jObj === undefined) {jObj = $wnd.isc.DS.get(this.inheritsFrom).__ref;}var responseJ = __gwt_makeJavaInvoke(1)(null, 4522065, dsResponse);var requestJ = __gwt_makeJavaInvoke(1)(null, 4587641, dsRequest);__gwt_makeJavaInvoke(3)(jObj, 4456667, responseJ, requestJ, data);}),[object Object],[object Object])@http://localhost:9995/myprogram/myprogram/hosted.html?myprogram:56
    ([object Object],[object Object],[object Object])@http://localhost:9995:20
    isc_DataSource__completeResponseProcessing([object Object],[object Object],[object Object],[object Object],[object Object])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:524
    isc_DataSource__handleClientOnlyReply([object Object],[object Object],[object Object])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:380
    isc_c_Class_fireCallback([object Object],"rpcResponse,data,rpcRequest",[object Array],[object Object],(void 0))@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_Core.js:282
    isc_Class_fireCallback([object Object],"rpcResponse,data,rpcRequest",[object Array])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_Core.js:376
    isc_c_RPCManager_fireReplyCallback([object Object],[object Object],[object Object],[object Object])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:1127
    isc_c_RPCManager_fireReplyCallbacks([object Object],[object Object])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:1130
    isc_c_RPCManager_performOperationReply([object Object],[object Object])@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:1126
    isc_c_RPCManager__performTransactionReply(20)@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_DataBinding.js:1122
    isc_c_Class_fireCallback([object Object],(void 0),[object Array],[object Object],true)@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_Core.js:282
    isc_c_Timer__fireTimeout("$ir516")@http://localhost:9995/myprogram/myprogram/sc/modules/ISC_Core.js:1153
    @http://localhost:9995/myprogram/myprogram/sc/modules/ISC_Core.js:1148

    So is there an update to the Javascript files that would fix this problem?

    Thanks.

    Chris

    #2
    Can you show this as a standalone test case, including the XML response?

    Comment


      #3
      Yes I should be able to do that. Not sure if it matters but the data is all local so there really is no server-side response to speak of when this exception is being thrown.

      But the data originally comes from the server as JSON. But here's the complete code for my data source to see if that sheds some light on things:

      Code:
      public class ListSource extends RestDataSource {
      
      	private static ListSource instance = null;
      	private static RestDataSource cachedInstance = null;
      	
      	public static ListSource getInstance(){
      		if(instance == null){
      								
      			instance = new ListSource("DBList_DS");							
      						
      			instance.fetchData(new Criteria(),new DSCallback(){
      				
      				@Override
      				public void execute(DSResponse response, Object rawData,
      						DSRequest request) {
      					
      					cachedInstance = new RestDataSource();
      					cachedInstance.setClientOnly(true);
      					cachedInstance.setCacheAllData(true);
      					cachedInstance.setInheritsFrom(instance);
      					cachedInstance.setCacheData(response.getData());
      					
      				}
      				
      			});
      			
      		}
      		
      		return instance;
      	}
      	
      	public static RestDataSource getCachedInstance(){
      		return cachedInstance;
      	}
      	
      	public void reloadCache(){
      		
      		instance.fetchData(new Criteria(),new DSCallback(){
      			
      			@Override
      			public void execute(DSResponse response, Object rawData,
      					DSRequest request) {
      						
      				cachedInstance.setCacheData(response.getData());
      				
      			}
      			
      		});
      	}
      	
      	public ListSource(String id){
      		setID(id);		
      		setShowPrompt(false);
      		setDataFormat(DSDataFormat.JSON);
      		setDataProtocol(DSProtocol.POSTPARAMS);
      		setClientOnly(false);
      		setDataURL(Utils.constants.url());
      		
      		HashMap<String, String> m = new HashMap<String, String>();
      		m.put("app", "lists");
      		
      		setDefaultParams(m);
      		
      		setAddDataURL(Utils.constants.url());
      			
      		DataSourceIntegerField idField = new DataSourceIntegerField("id");
      		idField.setHidden(true);
      		idField.setPrimaryKey(true);
      				
      		DataSourceIntegerField attribField = new DataSourceIntegerField("attributeID");
      		attribField.setHidden(true);
      		
      		DataSourceTextField descriptionField = new DataSourceTextField("description","Description");
      		
      		DataSourceIntegerField parentField = new DataSourceIntegerField("parent");
      		parentField.setHidden(true);
      		
      		DataSourceIntegerField editField = new DataSourceIntegerField("editable");
      		editField.setHidden(true);
      		
      		setFields(idField,attribField,descriptionField,parentField,editField);
      	}
      }

      Comment

      Working...
      X