私は Ext-GWT を使用していますListView
が、必要なものに適したレイアウトだと思います。私の問題は、すべてのアイテムに HTML テンプレートを使用する必要があることですが、代わりに GWT/Ext-GWT ウィジェットを作成したいのでdiv
、適切なウィジェットに置き換えるプレースホルダーを使用しています。
div
をウィジェットに置き換えるにはどうすればよいですか? 私の最初の試みは を使用することでしたが、ウィジェット内にある をRootPanel.get('div-id')
作成できないようですRootPanel
(サイレント例外が見つかるまで、デバッグ モードを使用してコードをステップ実行しました)。
public class TicketContainer extends LayoutContainer {
private ArrayList<BasicTicket> tickets;
public TicketContainer(ArrayList<BasicTicket> tickets) {
this.tickets = tickets;
}
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FlowLayout(1));
ListStore<BasicTicket> store = new ListStore<BasicTicket>();
store.add(this.tickets);
ListView<BasicTicket> view = new ListView<BasicTicket>(store);
view.addListener(Events.Refresh, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
for (BasicTicket ticket : tickets) {
// At this point I need to find the div with the id
// "ticket_"+ticket.getId() and replace it with a GWT
// widget that I can add events to and enable drag and drop
}
}
});
add(view);
}
private native String getTemplate() /*-{
return ['<tpl for=".">',
'<div id="ticket_{id}"></div>',
'</tpl>'].join("");
}-*/;
}
コードに追加のコンテキストが必要な場合は、完全なソースはhttps://code.launchpad.net/~asa-ayers/+junk/Kanbanにあります。