getting data to grid

Hi All,

i am very new to great smartGWT…

i am developing an application where we need to display 10 rows of 4 coloumn each
retrieving it from the mysql server…
i am able to get the values from server by RPC and on success() we are storing it in the grid…code is below:-
public void onSuccess(Object result)
{

MasterDataResponseObject masterDataResponseObj =(MasterDataResponseObject) result;
List<MasterDataBean> masterDataBeanList=masterDataResponseObj.getMasterDataList();

ListGridRecord record=new ListGridRecord() ;
for(MasterDataBeanmdList : masterDataBeanList) {
record.setAttribute(“MasterDataType”,mdList.getCategoryName());
record.setAttribute(“Key”,mdList.getCategoryKey());
record.setAttribute(“Value”,mdList.getCategoryValue());
record.setAttribute(“Status”,mdList.getMasterDataStatus());
dataSource.addData(record);
countryGrid.setDataSource(dataSource);
}

i am able to get all the values from the server inside the success() function but only the last row retrieved is repeated and displayed in all the rows?

Move the initialization of record to inside the for loop. By keeping it outside you are just creating one record and changing its content each time.