Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

How can we use synchronous Datasource operations?

$
0
0
Hi All,

I am new to use/learn SmartGWT and stuck with a problem regarding Datasource. I have a Datasource fetch operation and the value I get from DSCallBack of this is processed in subsequent logic. But since the Datasource operations are asynchronous, am sometimes left with blank/null values.

Let me know if I am doing something wrong or if there is a way to do Synchronous calls to Datasource.

Code:

        private String setRoleField(String attribute) {
                Criteria rolefetchCriteria = new Criteria();
                rolefetchCriteria.addCriteria("searchFlag", 1);
                rolefetchCriteria.addCriteria("User_ID", attribute);

                requestProperties =new DSRequest();               
                requestProperties.setOperationId("outletRoleFetch");
               
                DataSource.get("recently_accessed_module").fetchData(rolefetchCriteria, new DSCallback()
                {
                        @Override
                        public void execute(DSResponse dsResponse, Object data,
                                        DSRequest dsRequest) {
                                       
                               
                                Record[] record = dsResponse.getData();       
                                outletRole = "";
                                for(Record singlerecord: record)
                                        outletRole += "<font class='overview-subtitle'>"+singlerecord.getAttribute("OutletName")+"</font><font class='overview-time-label'>"+ singlerecord.getAttribute("Role")+"</font>";       

                        }
                       
          },requestProperties);       

return outletRole;
        }

This code is always returning me "" empty value.

The Smartclient version am using is -->SmartClient Version: v10.0d_2014-09-09/EVAL Deployment

Thanks,
Babu

Viewing all articles
Browse latest Browse all 4756

Trending Articles