Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/422.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript foreach循环中的折叠表不';行不通_Javascript_Html_Css_Asp.net - Fatal编程技术网

Javascript foreach循环中的折叠表不';行不通

Javascript foreach循环中的折叠表不';行不通,javascript,html,css,asp.net,Javascript,Html,Css,Asp.net,我正在尝试制作一个发票报告,其中销售人员有一个总计行,如果单击该报告,它将显示每个sp对应的发票。我使用的是foreach循环,但第二行没有展开。我知道这和tr的id有关,但我不知道为什么 <div id="grandparent" class="list-group-item"> <div class="collapsed" data-toggle="collapse" data-target="#grandparentContent

我正在尝试制作一个发票报告,其中销售人员有一个总计行,如果单击该报告,它将显示每个sp对应的发票。我使用的是foreach循环,但第二行没有展开。我知道这和tr的id有关,但我不知道为什么

     <div id="grandparent" class="list-group-item">
                <div class="collapsed" data-toggle="collapse" data-target="#grandparentContent" data-role="expander" data-group-id="grandparent">
                    <ul class="list-inline">
                        <li class="icon-class"></li>
                        <li>Raporti</li>
                    </ul>
                </div>

<div class="collapse" id="grandparentContent" aria-expanded="true">
                    <table class="table">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Agjenti</th>
                                <th>Total Polisa</th>
                                <th>Te Vlefshme</th>
                                <th>Te Pa Vlefshme</th>
                                <th>Te Vlefshme $</th>
                                <th>Te Pa Vlefshme $</th>

                            </tr>
                        </thead>

    @foreach (var agent in @Model.AgentsTotal.Individuals)
    {
        <tbody>
            <tr class="collapsed" data-toggle="collapse" data-target="#collapseone_@agent.Agjenti" data-role="expander">
                <td class="icon-class"></td>
                <td>@agent.Agjenti</td>
                <td>@agent.TotalPolisa</td>
                <td> @agent.TeVlefshme</td>
                <td> @agent.TepaVlefshme</td>
                <td> @agent.VleraTeVlefshme</td>
                <td> @agent.VleraTePaVlefshme</td>
            </tr>
            @foreach (var police in agent.IndividualPolices)
            {
                <tr class="collapse collapseone_@agent.Agjenti" id="collapseone_@agent.Agjenti" aria-expanded="true" >
                    <td>
                        <a asp-controller="Polisat" asp-action="Detail" asp-route-id="@police.PoliceId">@police.PoliceNo</a>
                    </td>
                    <td>
                        @police.Klienti
                    </td>
                    <td>
                        @police.Paketa
                    </td>
                    <td>
                        @police.Valide
                    </td>
                </tr>
            }
             </tbody>
     }



                    </table>
                </div>
            </div>

  • 拉波蒂
阿杰蒂 波利萨全城 特弗尔弗什姆 特帕夫什姆 特弗尔弗什姆$ 特帕夫什姆$ @foreach(@Model.AgentsTotal.Persons中的var代理) { @Agjenti探员 @TotalPolisa探员 @特夫莱夫什梅探员 @特帕夫勒弗什特工 @我是弗雷夫什姆探员 @弗勒弗什探员 @foreach(代理中的var警察。个人警察) {


就我而言,父母1(在样本中)可折叠行不会展开或折叠。

适用于可能有此问题的任何人。使用foreach循环时,请确保在日期目标上传递的值是唯一的int值。在上面的示例中,我传递的是日期目标无法识别的字符串。

请不要使用场外链接。请确保您的问题是c完整到足以回答StackOverflow问题。这样,如果你的链接消失,这个问题仍然有用。你是如何执行折叠/展开的?执行此操作的代码在哪里?我看不到。因此,不,你的问题不够清楚。你还包括“html”和“css”等标记但是这个问题与CSS无关,因为这个问题中没有包含任何样式。折叠/展开是在视图中的javascript上执行的,它与问题无关,因为它在折叠类上工作,在我的代码中,它包含的行。问题在上面的代码中,看起来你更像是一个主持人,而不是一个问题艾弗,什么都不用谢
  @foreach (var police in agent.IndividualPolices)
        {
            <tr class="collapse collapseone_@agent.Agjenti" id="collapseone_@agent.Agjenti" aria-expanded="true" >
                <td>
                    <a asp-controller="Polisat" asp-action="Detail" asp-route-id="@police.PoliceId">@police.PoliceNo</a>
                </td>
                <td>
                    @police.Klienti
                </td>
                <td>
                    @police.Paketa
                </td>
                <td>
                    @police.Valide
                </td>
            </tr>
        }