I know the primary key fieldname and the primary key, and I want to know the value of another known fieldname in the DataSource. How do I do this?
I have tried with fetchData(Criteria criteria, DSCallback callback), (DSCallback code below)
SC.say(returnValue) shows the right value but when I use getValue() the return string is Empty.
I have tried with fetchData(Criteria criteria, DSCallback callback), (DSCallback code below)
SC.say(returnValue) shows the right value but when I use getValue() the return string is Empty.
Code:
package com.companyweb.client.ui.data; import com.smartgwt.client.data.DSCallback; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.data.Record; import com.smartgwt.client.util.SC; public class CustomDSCallback implements DSCallback{ private String returnValue = ""; private String fieldNameToGet = ""; public CustomDSCallback(String fieldNameToGet){ this.fieldNameToGet = fieldNameToGet; } @Override public void execute(DSResponse response, Object rawData, DSRequest request) { Record fetchedData = response.getData()[0]; if(fetchedData != null) { returnValue = fetchedData.getAttribute(fieldNameToGet); SC.say(returnValue); } else SC.say("CustomDSCallback failed!"); } public String getValue() { return returnValue; } }
Comment