0

残念ながら、まだ画像を投稿することはできませんが、説明しようと思います。画像があり、Chrome ブラウザや Opera の空白ページのボタンのように使用したいと考えています。しかし、その結果、画像との線があり、次の画像が次の行にあり、すべての行 (画像だけでなく) がアクティブです。

それで、どうすればこれを行うことができますか。私のコードと ext gwt 2.2 エクスプローラー サイトにある例のコードとの違い (重要な違い) を見つけようとしています。これが私のコードです:

public class QueryPanel extends LayoutContainer {


public QueryPanel(final String customerId, final String login, final String password){

    setLayout(new FitLayout());
    final ContentPanel gallery = new ContentPanel();
    gallery.setHeading("Reports");
    gallery.setLayout(new FitLayout());
    gallery.setCollapsible(true);
    gallery.setAnimCollapse(false);
    gallery.setFrame(true);
    gallery.setId("images-view");
    gallery.setWidth(535);

    ListStore<GalleryButtonModel> store = new ListStore<GalleryButtonModel>();
    store.add(new GalleryButtonModel("Copy all messages", "CopyIcon.png", new CopyMsgs(customerId)));
    store.add(new GalleryButtonModel("Spam report", "spam.gif", new SpamReport(customerId, login, password)));
    store.add(new GalleryButtonModel("Top customers report", "topCustomers.gif", new TopCustomersReport(customerId, login, password)));
    store.add(new GalleryButtonModel("Total report", "total-report.gif", new TotalReport(customerId, login, password)));
    store.add(new GalleryButtonModel("Message througput report", "message-troughput.gif", new MessageThroughputReport(customerId, login, password)));
    store.add(new GalleryButtonModel("Delivery time report", "delivery-time.gif", new DeliveryTimeReport(customerId, login, password)));
    store.add(new GalleryButtonModel("Action type report", "report.gif", new ActionTypeReport(customerId, login, password)));

    ListView<GalleryButtonModel> view = new ListView<GalleryButtonModel>() {
        @Override
        protected GalleryButtonModel prepareData(GalleryButtonModel model) {
            String s = model.get("name");
            model.set("shortName", Format.ellipse(s, 15));
            return model;
        }

    };

    view.setId("img-chooser-view");
    view.setTemplate(getTemplate(""));
    view.setStore(store);
    view.setItemSelector("div.thumb-wrap");
    view.getSelectionModel().select(0, false);
    view.getSelectionModel().addListener(Events.SelectionChange,
            new Listener<SelectionChangedEvent<GalleryButtonModel>>() {

                public void handleEvent(SelectionChangedEvent<GalleryButtonModel> be) {
                    be.getSelectedItem().getExample().getButtonModel();
                }

            });
    VBoxLayoutData vFlex = new VBoxLayoutData();
    vFlex.setFlex(1);
    gallery.add(view, new FitData(5,5,5,5));
    add(gallery, vFlex);     
}    

    private native String getTemplate(String base)/*-{
        return ['<tpl for=".">',
            '<div class="thumb-wrap" id="{name}">',
            '<div class="thumb"><img src="/gxt/images/default/button/{path}" title="{name}"></div>',
            '<span class="x-editable">{shortName}</span></div>',
            '</tpl>',
            '<div class="x-clear"></div>'].join("");

    }-*/;
}
4

1 に答える 1

0

おそらくこの例について話しているようですね: http://www.sencha.com/examples-2/#listview

(この投稿で利用可能な画像、同じ質問の別の化身http://www.sencha.com/forum/showthread.php?257343-ListView-Template )

使用しているテンプレートでは、css クラスthumbthumb-wrap. これらは、html 構造に追加された単なる文字列ではなく、ページの CSS で意味を持ちます。ここに適用される firebug に従って選択されたビットを次に示します。

#images-view .thumb-wrap {
    border: 1px solid white;
    float: left;
    margin: 4px 0 4px 4px;
    padding: 5px;
}


#images-view .thumb {
    background: none repeat scroll 0 0 #DDDDDD;
    padding: 3px;
}

これらの規則は、 idのコンテナ内に配置されたときにthumbおよびthumb-wrap クラスで要素をスタイルする方法を説明しています。コードの別の場所に id が設定されていますが、それを削除したい場合は、これらのルールを単純化できる場合があります。images-view

スタイルは、float:left;特に左から右、次に上から下に並べる原因となっています。もちろん、他にどのスタイルを使用するかはあなた次第ですが、これらのルールがページの CSS ファイルにない場合、それらの要素はそれらによってスタイル設定されません。

于 2013-02-27T23:33:01.177 に答える