Announcement

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

    ListGrid to TreeGrid Drag and Drop problem

    Hi Isomorphic,

    SmartClientVersion: 8.0 (SmartClient_SC_SNAPSHOT-2010-10-17)
    Browser: Mozila

    I am trying to build a simple application that has one TreeGrid and one ListGrid. Both Grids have different datasources. What I am trying to achieve is drag and Drop from ListGrid to TreeGrid but unable to do it. As per my understanding a 'remove' operation will be invoked whenever I drag any record from listGrid to TreeGrid but instead of 'remove' an 'update' is being issued. Also an 'add' operation will be invoked when an 'drop' event is received on TreeGrid but it is not happening. Below is my code with Two Grids and corresponding datasource.

    ListGrid and DS:
    Code:
    isc.RestDataSource.create({
    ID:"topologySationsInfoDS",
    recordXPath:"//topologySationsInfoDS",
    sendMetaData:true,
    transformResponse:function (dsResponse, dsRequest, data) { 
    var dsResponse = this.Super("transformResponse", [dsResponse,dsRequest,data]);
    		var operation = dsRequest.operationType ;
    		var resStatus = dsResponse.status;
    		var resp = dsResponse.data;
    
    		if(resStatus == 0)
    		resp = isc.XMLTools.toJS(data).data;
    
    		
    		showNotificationMessage(resp);
    },
    metaDataPrefix:"",
    httpMethod:"post",
    operationBindings: [
           {operationType:"fetch",dataProtocol:"postParams",dataURL:"./stationManagerGetAllStations.htm"},       
    	   {operationType:"fetchChildDevices",dataProtocol:"postParams",dataURL:"./locationControllerGetDevicesOfLocation.htm"}
        ],
    dataFormat:"xml",
    showPrompt:false,
    fields: [
    	{name:"id",primaryKey:true},
    	{name:"label"},	
    	{name:"profileID", title:"Profile ID"},
    	{name:"locationId", title:"Location ID",foreignKey:"locationStructureDS.id"}
    	
    	]	
    
    });
    
    
    isc.ListGrid.create({
        ID:"childStationsList",
        dataSource:"topologySationsInfoDS",
        useAllDataSourceFields:false,
    	autoDraw:false,
    	autoFetchData:false,
        canEdit:false,
        modalEditing:false,
        alternateRecordStyles:true,
        canReorderRecords: true,
        canDragRecordsOut: true,
        canAcceptDroppedRecords: true,
        dragDataAction: "move",
        fields:[
    	{name:"id",primaryKey:true,showIf:"false"},
    	{name:"label", title:"Location"}
        ]
        
        
    
    });
    TreeGrid and DS:
    Code:
    isc.RestDataSource.create({
    ID:"locationStructureDS",
    recordXPath:"//locationStructureDS",
    sendMetaData:true,
    transformResponse:function (dsResponse, dsRequest, data) { 
    var dsResponse = this.Super("transformResponse", [dsResponse,dsRequest,data]);
    		var operation = dsRequest.operationType ;
    		var resStatus = dsResponse.status;
    		var resp = dsResponse.data;
    
    		if(resStatus == 0)
    		resp = isc.XMLTools.toJS(data).data;
    	
    		showNotificationMessage(resp);
    },
    metaDataPrefix:"",
    httpMethod:"post",
    operationBindings: [
        {operationType:"add", dataProtocol:"postParams",dataURL:"./locationControllerAddLocation.htm"},   
    	 {operationType:"update", dataProtocol:"postParams",dataURL:"./locationControllerAddLocation.htm"},   
        {operationType:"remove", dataProtocol:"postParams",dataURL:"./locationControllerDeleteLocation.htm"},
    	{operationType:"fetch", dataProtocol:"postParams",dataURL:"./locationControllerGetAllLocations.htm"}
        ],
    dataFormat:"xml",
    showPrompt:true,
    fields: [
    	{name:"id",primaryKey:true,hidden:true},
    	{name:"label", title:"Label"},
    	{name:"type" , title:"Type",hidden:true},
    	{name:"user", title:"User",hidden:true},	
    	{
                foreignKey:"locationStructureDS.id",
                hidden:true,
                name:"parentId",
                required:true,
                rootValue:"0",
                type:"integer"
            }
    	]	
    
    });
    
    
      isc.TreeGrid.create({	 
        ID: "topologyTree",
      nodeClick:function(viewer, node, recordNum){
    	
    	 childStationsList.fetchData({id:node.id,type:node.type},null,{operationType:"fetchChildDevices"});
    	
    	
    		  },
    	nodeIcon:"[SKIN]folder_open.png",
    	loadDataOnDemand:false,	
    	dataSource: "locationStructureDS",
    	showHeader:false,
    	leaveScrollbarGap:false,
    	animateFolders:true,
    	selectionType:"single",
    	animateRowsMaxTime:750,
    	cellContextClick:function (viewer, folder, recordNum){return treeGridMenu.showContextMenu()},
    	autoDraw:false,
    	autoFetchData:false,	
    	canAcceptDroppedRecords: true
    			
    	
    });
    I am struggling with this problem for couple of days so please help me.

    Thanks.

    #2
    Please help i am not making any progress.

    Thanks.

    Comment

    Working...
    X