ListGrid data reload.

Hi

I have a ListGrid with 10 records getting populated with links on 2 fields.

My Requiremnt is:
If i click on the link, it should go to the server, change the status of the queue and then fillin the ListGrid with all the queues info with new data.

but what’s happening is:
When i click on link, it hits the server, changes the status of that queue,
but while reloading the List Grid, though i set did setdata() and then call fetchData(), Its not hitting the server and just populating the old data.

What could be wrong in my code.

Here is my code.

isc.DataSource.create({
    ID:"DashboardListDS",
    dataFormat: "json",    
   	fields:[   	 
     	{ name:"queuetype", title:"Queue Type" ,width:"100"},     
     	{ name:"queuename", title:" Queue Name" , width:"100"},
     	{ name:"queueStatus", title:"Queue Status", width:"100", align:"center",type:"image", imageSize:14, imageURLPrefix:"<%=request.getContextPath()%>/images/", imageURLSuffix:".gif"},
     	{ name:"startstop", title:"start/stop", width:"100",align:"center", width:100, type:"text", canGroupBy:false} ,
     	{ name:"holdresume", title:"hold/resume", width:"100",align:"center", width:100, type:"text", canGroupBy:false},
     	{ name:"serverpath", visibility:"hidden"}
     ],
      transformRequest:function (dsRequest){
        if (dsRequest.operationType == "fetch") {            
              alert(" in dsRequest fetch--> "+this.dataURL);            
             dsRequest.invalidateCache = true;           
        }
        
    },
     transformResponse : function (dsResponse, dsRequest, jsonData) {
   
     		if (dsRequest.operationType == "fetch") {
     		 alert(" in dsResponse fetch"); 
     		var serverpath = ServersGrid.getSelectedRecord().serverlink;
     		
     		
     		for(var j=0; j< dsResponse.totalRows; j++){
     			var QClass = "";
     			if(dsResponse.data[j].queuetype == "loadbalancequeues"){
     			   QClass = "LoadbalanceQueue"; 
     			}else if(dsResponse.data[j].queuetype == "bouncequeues"){
     			   QClass = "BounceQueue"; 
     			}else if(dsResponse.data[j].queuetype == "pollingqueues"){
     			   QClass = "PollingQueue"; 
     			}else if(dsResponse.data[j].queuetype == "devicequeues"){
     			   QClass = "DeviceQueue"; 
     			}else if(dsResponse.data[j].queuetype == "routequeues"){
     			   QClass = "RouteQueue"; 
     			}
     			
     			var Qname = dsResponse.data[j].queuename;     	
     			var Qtype = dsResponse.data[j].queuetype;
    			var Qlink = "";    		   	
     	    		    			
     			
     			if(dsResponse.data[j].queueStatus == "start"){
     				Qlink = "http://<%=request.getServerName()%>:<%=request.getServerPort()%><%=request.getContextPath()%>/"+QClass+"?queuename="+Qname+"&action=stop&serverpath="+serverpath+"&queuelink=Treeview";
     				dsResponse.data[j].startstop ="<a href=javascript:performAction('"+Qname+"','"+Qtype+"','"+Qlink+"','"+serverpath+"')>stop</a>"; 
    				 Qlink = "http://<%=request.getServerName()%>:<%=request.getServerPort()%><%=request.getContextPath()%>/"+QClass+"?queuename="+Qname+"&action=hold&serverpath="+serverpath+"&queuelink=Treeview";
     			    dsResponse.data[j].holdresume="<a href=javascript:performAction('"+Qname+"','"+Qtype+"','"+Qlink+"','"+serverpath+"')>hold</a> ";   				
    			}else if(dsResponse.data[j].queueStatus == "stop"){
     			    Qlink = "http://<%=request.getServerName()%>:<%=request.getServerPort()%><%=request.getContextPath()%>/"+QClass+"?queuename="+Qname+"&action=start&serverpath="+serverpath+"&queuelink=Treeview";
     				dsResponse.data[j].startstop="<a href=javascript:performAction('"+Qname+"','"+Qtype+"','"+Qlink+"','"+serverpath+"')>start</a> ";
     			}else if(dsResponse.data[j].queueStatus =="hold"){
     				Qlink = "http://<%=request.getServerName()%>:<%=request.getServerPort()%><%=request.getContextPath()%>/"+QClass+"?queuename="+Qname+"&action=stop&serverpath="+serverpath+"&queuelink=Treeview";
     			    dsResponse.data[j].startstop="<a href=javascript:performAction('"+Qname+"','"+Qtype+"','" +Qlink +"','"+serverpath+"')>stop</a> ";
     			    Qlink = "http://<%=request.getServerName()%>:<%=request.getServerPort()%><%=request.getContextPath()%>/"+QClass+"?queuename="+Qname+"&action=resume&serverpath="+serverpath+"&queuelink=Treeview";
     			    dsResponse.data[j].holdresume = "<a href=javascript:performAction('"+Qname+"','"+Qtype+"','"+Qlink+"','"+serverpath+"')>resume</a> ";     			
     			}
     			
     			}
     			
     			
     		}
     		    		
     		return dsResponse;	
     }
     
         
})

isc.ListGrid.create({
	ID:"DashboardGrid",
	dataSource: "DashboardListDS",
   // width:500, height:224,
    alternateRecordStyles:true, showAllRecords:true,  
    autoFetchData: false,
    autoDraw: true,
      showEmptyMessage: true,
         emptyMessage: "To display, please click the servername"
});

isc.DataSource.create({
	ID:"queuesActionDS",
	dataFormat: "json",   
    dataProtocol:"postParams",    
      transformRequest : function (dsRequest ) {   	
       			if (dsRequest.operationType == "fetch") {     				
     				alert("DATA URL  in QueuesActionDS dsRequest : "+ this.dataURL);     				
     			}   	   	
         },
          transformResponse : function (dsResponse, dsRequest, jsonData) {
   				var serverpath = ServersGrid.getSelectedRecord().serverlink;
     		if (dsRequest.operationType == "fetch") {
     		
    			var status = isc.XMLTools.selectObjects(jsonData, "/response/status");
    			 alert("status :"+status);    			 
				if ((status != null )) {		     			
	     		DashboardGrid.setData([]);   
    	     	DashboardGrid.fetchData();  
	     		}
	     		}
	     		dsResponse.invalidateCache = true; 
     	 	return dsResponse;
     		}      
         
    });

function performAction(Qname,Qtype,Qlink, serverpath){   
     	
     	queuesActionDS.dataURL = Qlink;      	
     	queuesActionDS.fetchData();  
     		
     }

It’s not immediately clear why this isn’t working for you.
You could try calling invalidateCache() on the ListGrid’s data object instead of calling setData() followed by fetchData().

You might want to simplify your code down a bit to debug it - check whether you can get the desired re-fetch by calling your cache-drop code from a simple button click, for example, and then verify that this same code is actually being called in your application logic.

If you can’t get to the bottom of this, it would be helpful if you could simplify your code down to a standalone test case we can run on our end without any custom back end logic.

Thanks
Isomorphic Software

List Grid data reload.

Hi

The dataFormat is json.

I tried using
<CODE>
transformResponse : function (dsResponse, dsRequest, jsonData) {

	dsResponse.invalidateCache = true;
	return dsResponse;
	}

</CODE>

and tried using invalidateCache to ListGrid data as below.

<CODE>
DashboardGrid.data.invalidateCache();
DashboardGrid.fetchData();
</CODE>

Found this.

If the dataFormat is of xml, on every hit on List Grid hits the server for fresh data. but doesn’t work with json dataFormat.

Any idea why is it so?

Thanks in advance.

List Grid data reload.

Hi

I found the solution.

Problem is not with the dataFormat.
If the dataURL is same for every request, the dsRequest is not fetching the data from the server. Its getting the old data.

If the dataURL is appended with the parameters changed,
the dsRequest call is hitting the server.

Thanks