I have a listgrid i want to change the datasource dynamically based on condition .. How to did it.....
	It Should call separate webservice based on condition and should corresponding feilds retuened by it..
I want to set and reset the datasource dynamically.
I am able to set the feilds but not datasource .
It should switch between the datasource dynamically...
					Code:
	
	
isc.ListGrid.create({
        ID: "lgrptcard",
       // top:"23%",
        width:"100%",
        height:"68%", 
        border:"0",
        headerHeight:40, 
        border:"0",
        bodyBackgroundColor:"#808080",
        showSortArrow:"none", 
        showFilterEditor:false, 
        sortDirection:false,
        autoDraw:true,
        showAllRecords:true,
        align:"center",
       // canFreezeFields:true,
        dataSource:getDygriddata,
        fields:MainArray,
        showHeader:true,
        enterKeyEditAction:"nextRow",
        editEvent: "click",
        baseStyle: "myBoxedAlternateGridCell", 
        alternateRecordStyles:true,
        canDragSelect: true,
        editByCell: true,
        canReorderFields:false,
      //  canEdit:true, //
        autoSaveEdits:false,
        recordClick:function(rowNum, colNum)
        { 
     
        },
       canEditCell : function (rowNum, colNum) 
        {
            
          
            }
            // otherwise return the returnValue of the superclass implementation
            //                               } 
            return canEdit; 
     },
    
editorExit:function(editCompletionEvent, record, newValue, rowNum, colNum) 
{
           return true;
    }
}                       
}) 
if(Condition 1)
{
getDygriddata ;= RptService.getFetchDS("GetRosterGrades2_final_last", null, { recordXPath:"//Table" });
lgrptcard.fetchData({});
  lgrptcard.setFeilds(MainArray);             
               }
}
else
{
getDygriddata = RptService.getFetchDS("GetStudentSkillSetsNew", null, { recordXPath:"//dtemp" });
lgrptcard.fetchData({});
lgrptcard.setFeilds(MainArray);
}
I want to set and reset the datasource dynamically.
I am able to set the feilds but not datasource .
It should switch between the datasource dynamically...

Comment