簡體   English   中英

帶有jQuery手風琴的中繼器中的中繼器

[英]Repeater inside a repeater with jQuery accordion

最近,我根據本教程做了一個嵌套轉發器。 一樣的東西

http://www.codeproject.com/Articles/6140/A-quick-guide-to-using-nested-repeaters-in-ASP-NET

但是我像下面的示例一樣添加了一個jQuery手風琴:

http://www.snyderplace.com/demos/accordion.html

一切都很好,但是我意識到了一些UI問題。 我的意思是,例如,如果我的一個嵌套轉發器有100條記錄,而另一個只有1條記錄,對於第二個只有1條記錄,則它保留了空白,因為它也有100條記錄。 有人知道如何使每個嵌套中繼器的高度適合其元素嗎?

<div id="accordion">
    <asp:Repeater ID="summary" runat="server" OnItemDataBound="summary_ItemDataBound">
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
            <div>
                Id:<asp:Literal ID="litCategory" runat="server" />
            </div>
            <div>
                <asp:Repeater ID="detail" runat="server" OnItemDataBound="detail_ItemDataBound">
                <HeaderTemplate>
                    <table>
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>Name</th>
                            </tr>
                        </thead>
                        <tbody>
                </HeaderTemplate>
                <ItemTemplate>
                        <tr>
                            <td><asp:Literal ID="litID" runat="server" /></td>
                            <td><asp:Literal ID="litName" runat="server" /></td>
                        </tr>
                </ItemTemplate>
                <FooterTemplate>
                        </tbody>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
            </div>
        </ItemTemplate>
        <FooterTemplate>
        </FooterTemplate>
    </asp:Repeater>
</div>

我知道了! 我找到了這個解決方案!

    $(function () {
        $("#accordion").accordion({
            collapsible: true,
            heightStyle: "content"
        });
    });

我需要將其指定為屬性,僅此而已!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM