Announcement

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

    Dynamic DataSources

    Smartclient version 9.1-p


    Hi,
    for the evaluation of the product I have tried the following functionality: http://www.smartclient.com/#FSeditab...SideDataSource (notice: the example not work correctly!)

    In web.xml i have declared the init servlet in this way:
    Code:
      
      <servlet>
            <servlet-name>DynamicDS</servlet-name>
            <servlet-class>com.isomorphic.DynamicDS</servlet-class>
            <load-on-startup>3</load-on-startup>
        </servlet>

    In DynamicDS.java:
    Code:
    	...
    	private final String SUFFIX_DYNAMIC="dynamic"
    
    	public void init(ServletConfig servletConfig) throws ServletException{
    		
    		super.init(servletConfig);
    
    		DynamicDSGenerator ddsg = new DynamicDSGenerator(){
    			@Override
    			public DataSource getDataSource(String id, DSRequest dsRequest){
    				
    				try{
    					if (id.equalsIgnoreCase(SUFFIX_DYNAMIC)) {
    						//method used to construct xml relative to dasasource
    						makeDs(dsRequest);
    						Document xml = composeDataSource();
    						String prettyPrint = serializeInString(xml);
    
    						return  DataSource.fromXML(prettyPrint);
    					}else
    						return null;
    				}catch (Exception e){
    					e.printStackTrace();
    					return null;
    				}
    			}
    		};
    		DataSource.addDynamicDSGenerator(ddsg, SUFFIX_DYNAMIC);
    	}
    *makeDS(dsRequest):
    In the dynamic construction of the datasource (makeDs()) I have defined the following features:
    -added new fields
    -added the class to serverObject with attribute className="..." and lookupStyle="new"

    className is defined the java class for fetch/add/update/remove method.

    When press button the javascript to execute is the follow:
    Code:
    ...
    		isc.DataSource.create({
    			ID:"exampledynamic",
    			fields:[
    			        {name:"prova", title:"prova"}
    			        ]
    		});
    
    		isc.ListGrid.create({
    			ID: "eventDateGrid",
    			top: 80,
    			left:10, 
    			width:1024, 
    			height:350,
    			autoDraw: true,
    			alternateRecordStyles:true,
    			dataSource: exampledynamic,
    			autoFetchData: true,
    			showFilterEditor: true,
    			invalidateCache: true,
    			filterOnKeypress: true
    		});
    		
    
            var crit = {
                       _constructor:"AdvancedCriteria",
                       operator:"and",
                       criteria:[
                           // this is a Criterion
                           { fieldName:"toServer", operator:"iContains", value:"value"}
                       ]
            };
            
            eventDateGrid.fetchData(crit, callbackEventDateGridFetch);
            
            function callbackEventDateGridFetch(){
    			say("2 - eventGrid data fetched."); 
            }
    		...
    The problem is the following:
    The DSRequest and DSResponse are processed correctly (I have analyzed the flow in debug mode: both server side and client side), but the graphics (smartclient component) in this case "ListGrid" is not updated is not updated with new field whereas the old field (in this case "prova") is enhanced with right data. Where am I wrong? What should I do more?

    PS: It does not appear any error (both java side, both side javscript).
    Last edited by raffaelecolatrellaathp; 20 Oct 2014, 03:48.

    #2
    but the graphics (smartclient component) in this case "ListGrid" is not updated is not updated with new field whereas the old field (in this case "prova") is enhanced with right data
    We really have no idea what you mean by this. Try to be *much* more specific.

    Comment


      #3
      Sorry, try to simplify the question. Basically, i'm trying to replicate your example that I found in the "Hands Live Demo" link: http://www.smartclient.com/#FSeditableServerSideDataSource (replace: the example not work correctly!) Can you give me a reference to example without problem?

      Comment


        #4
        There is no problem with this sample if you run it in your downloaded SDK.

        There *is* a problem with the public sample that appears to be related to the sandboxing approach we use on the website to prevent data vandalism. This does not affect the SDK and the code is already correct.

        Comment


          #5
          Just a quick note that we've also fixed the sandboxing issue that was preventing this sample from working correctly on smartclient.com

          Comment


            #6
            Originally posted by Isomorphic View Post
            Just a quick note that we've also fixed the sandboxing issue that was preventing this sample from working correctly on smartclient.com
            Now I have a gift from isomorphic: a premium license for free, because i have found a issue:-) I joke but I really appreciated the correction.

            Comment

            Working...
            X