Редът с повторител се разширява при щракване

Искам моя ред за повторител - когато щракна, разширете с няколко текстови полета в панел. Тук направих повторителя във формат на таблица с данните от базата данни. Когато се щракне върху всеки ред в повторителя, имам нужда панел да бъде видим с текстово поле в it.когато редът се щракне отново, панелът трябва да стане невидим.

Благодаря предварително за помощта

<asp:Repeater ID="RepSample" runat="server" DataSourceID="SqlDataSource1">
    <HeaderTemplate>
        <table cellpadding="1" cellspacing="1" width="100%" style="font-family: Verdana;
            border: 1px solid #C0C0C0; background-color: #D8D8D8">
            <tr bgcolor="#FF781E">
                <th>
                    LicenseID
                </th>
                <th>
                    LicenseName
                </th>
                <th>
                    StartDate
                </th>
                <th>
                    EndDate
                </th>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr style="background-color: White">
            <td>
                <%#DataBinder.Eval(Container, "DataItem.LicenseID")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.LicenseName")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.StartDate")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.EndDate")%>
            </td>
        </tr>
    </ItemTemplate>
    <AlternatingItemTemplate>
        <tr>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.LicenseID")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.LicenseName")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.StartDate")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container, "DataItem.EndDate")%>
            </td>
        </tr>
    </AlternatingItemTemplate>
    <FooterTemplate>
        </table></FooterTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:KTestConnectionString %>"
    SelectCommand="SELECT LicenseID, LicenseName, StartDate, EndDate FROM Krish">
</asp:SqlDataSource>

person user2745021    schedule 12.09.2013    source източник
comment

Използвам CS-Cart 4.1.x

Създадох замяна за блока "design\themes\basic\templates\blocks\products\products_text_links.tpl"

Кодът, който виждам във файла по подразбиране, е:

{** block-description:text_links **}

<{if $block.properties.item_number == "Y"}ol{else}ul{/if} class="bullets-list">

{foreach from=$items item="product"}
{assign var="obj_id" value="`$block.block_id`000`$product.product_id`"}
{if $product}
    <li>
        <a href="/bg{"products.view?product_id=`$product.product_id`"|fn_url}">{$product.product nofilter}</a>
    </li>
{/if}
{/foreach}

</{if $block.properties.item_number == "Y"}ol{else}ul{/if}>

Това, което трябва да направя, е просто да заменя следния ред с правилния код, за да покажа изображението по подразбиране на продукта вместо името му:

{$product.product nofilter}

Някакви идеи?

Благодаря

  -  person Michael B.    schedule 12.09.2013
comment
Devraj Благодаря ви за помощта   -  person user2745021    schedule 12.09.2013


Отговори (1)


jQuery може да помогне...

Направете своя jQuery плъгин с jQuery кода по-долу...

(function($) {
    $.fn.extend({
        collapsiblePanel: function() {
            //Call the ConfigureCollapsiblePanel function for the selected element
            return $(this).each(ConfigureCollapsiblePanel);
        }
    });
})(jQuery);

function ConfigureCollapsiblePanel() {
    //Wrap the contents of the container within a new div.
    $(this).children().wrapAll("<div class='collapsibleContainerContent'></div>");

    //Create a new div as the first item within the container.
    $("<div class='collapsibleContainerTitle'></div>").prependTo($(this));

    //Assign a call to CollapsibleContainerTitleOnClick for the click event of the new div.
    $(".collapsibleContainerTitle", this).click(CollapsibleContainerTitleOnClick);
}

function CollapsibleContainerTitleOnClick() {
    //The item clicked is the new div... get this parent (the overall container) and toggle the content within it.
    $(".collapsibleContainerContent", $(this).parent()).slideToggle();
}

aspx маркираща част

Поставете div във вашия Repeater ItemTemplate и му дайте класа collapsibleContainer

<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
        <div class="collapsibleContainer">
            <%-- Put your text boxes and other contents here --%>
        </div>
    </ItemTemplate>
</asp:Repeater>

Сега остава само функцията $().ready във вашата страница.

$().ready(function() {
    $(".collapsibleContainer").collapsiblePanel();
});

Разбира се, ще трябва да включите препратката към плъгина jQuery като таг на скрипта на вашата страница.

person Devraj Gadhavi    schedule 12.09.2013