Hi,
Is there any way to make a request synchronous? I want to display different icons in a ListGridField based on a fetch result using cellFormater, the code is like this:
of course this doesn't work because the String has been returned before the fetch result comes back. Is there a better way to do this?
Is there any way to make a request synchronous? I want to display different icons in a ListGridField based on a fetch result using cellFormater, the code is like this:
Code:
fieldInfo.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record,
int rowNum, int colNum) {
infoImgUrl = Canvas.imgHTML("icons/statistics-icon_16x16.png");
String parentConsignment = record.getAttributeAsString("pk_consignment_id");
Criteria criteria = new Criteria("parent_consignment",parentConsignment);
dsConsignmentManifest.fetchData(criteria, new DSCallback() {
public void execute(DSResponse response, Object rawData, DSRequest request) {
if (response.getData().length > 0) {
infoImgUrl = Canvas.imgHTML("icons/status_palet_35x16.png");
}
}
});
return infoImgUrl;
}
});
Comment