I have a DataSource class that extends com.smartgwt.client.data.DataSource. I have several DataSourceTextFields in it that show some Strings, and I need to also show an image button in one of the columns. The problem is that if I add another field like that:
DataSourceField icon = new DataSourceField("name", FieldType.ANY, "title");
setFields(/*the other fields*/, icon);
and then upon Fetch I add all values like that:
ArrayList<Record> records = new ArrayList<Record>();
// add all records in iteration, an then add the icon one
ListGridRecord iconRecord = new ListGridRecord();
ImgButton icon = new ImgButton();
icon.setSrc("theSrc/icon.png");
// icon.addClickHandler to execute some action
iconRecord.setAttribute("name", icon);
records.add(iconRecord);
response.setData(records.toArray(new Record[records.size()]));
processResponse(requestId, response);
All of this produces a com.google.gwt.core.client.JavaScriptException: (null): null - the table shows, but with empty rows and with this error in the Console (with no more details). I also tried to put the ImgButton in a HLayout, but I get the same error. I also tried to create a DataSourceImageField for the purpose, but then I have other errors. Could you, please, help? Thank you.