0

com.smartgwt.client.data.DataSource を拡張する DataSource クラスがあります。いくつかの文字列を表示するいくつかの DataSourceTextFields があり、列の 1 つに画像ボタンも表示する必要があります。問題は、そのような別のフィールドを追加すると:

DataSourceField icon = new DataSourceField("name", FieldType.ANY, "title");
setFields(/*the other fields*/, icon);

そして、Fetch で、次のようなすべての値を追加します。

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);

これらすべてが com.google.gwt.core.client.JavaScriptException: (null): null を生成します - テーブルは表示されますが、空の行とコンソールにこのエラーが表示されます (詳細はありません)。また、ImgButton を HLayout に配置しようとしましたが、同じエラーが発生します。目的のために DataSourceImageField も作成しようとしましたが、他のエラーが発生しました。助けてくれませんか?ありがとうございました。

4

0 に答える 0