Javascript laravel中带有更改数据的引导折叠
这是我的表代码和数据视图,但问题是,当我单击特定视图时,数据显示相同,而不是更改…就像我单击第一行一样,它显示数据,但当我单击第二行时,相同的数据显示,如何更改foreach循环中的数据视图?我有点困在这里了Javascript laravel中带有更改数据的引导折叠,javascript,laravel,laravel-5,eloquent,Javascript,Laravel,Laravel 5,Eloquent,这是我的表代码和数据视图,但问题是,当我单击特定视图时,数据显示相同,而不是更改…就像我单击第一行一样,它显示数据,但当我单击第二行时,相同的数据显示,如何更改foreach循环中的数据视图?我有点困在这里了 运动Id 性别 地方 国 状态 城市 行动 @foreach($challenges作为$challenge) {{$challenge->c_sport_id} {{$challenge->c_gender_id} {{$challenge->c_location} {{$chall
运动Id
性别
地方
国
状态
城市
行动
@foreach($challenges作为$challenge)
{{$challenge->c_sport_id}
{{$challenge->c_gender_id}
{{$challenge->c_location}
{{$challenge->c_country_id}
{{$challenge->c_state_id}
{{$challenge->c_city_id}
运动{{$challenge->c_sport_id}
性别{{$challenge->c_性别{u id}
位置{{$challenge->c_location}
国家{$challenge->c_country_id}
状态{{$challenge->c_state_id}
城市{$challenge->c_city_id}
日期{{$challenge->c_date}
desc{{$challenge->c_desc}
时间{{$challenge->c_time}
邀请{{$challenge->c_invite}
refree{{$challenge->c_refree_id}
@endforeach
运动id
性别歧视
地方
国
状态
城市
行动
您在数据目标中提供相同的id
,在折叠div中提供相同的id
属性,并随每一新行更改div id
@foreach($key=>$challenge)
{{$challenge->c_sport_id}
{{$challenge->c_gender_id}
{{$challenge->c_location}
{{$challenge->c_country_id}
{{$challenge->c_state_id}
{{$challenge->c_city_id}
运动{{$challenge->c_sport_id}
性别{{$challenge->c_性别{u id}
位置{{$challenge->c_location}
国家{$challenge->c_country_id}
状态{{$challenge->c_state_id}
城市{$challenge->c_city_id}
日期{{$challenge->c_date}
desc{{$challenge->c_desc}
时间{{$challenge->c_time}
邀请{{$challenge->c_invite}
refree{{$challenge->c_refree_id}
@endforeach
您的问题是,您为每个元素
提供了相同的id,但它不起作用,因此,您应该编写代码
,如下所示:
<table id="dtBasicExample" class="table table-striped table-bordered table-sm table table-condensed" cellspacing="0" width="100%" style="border-collapse:collapse;">
<thead>
<tr>
<th class="th-sm">Sport Id</th>
<th class="th-sm">Gender</th>
<th class="th-sm">Location</th>
<th class="th-sm">Country</th>
<th class="th-sm">State</th>
<th class="th-sm">City</th>
<th class="th-sm">Action</th>
</tr>
</thead>
<tbody>
@foreach ($challenges as $challenge)
<tr data-toggle="collapse" data-target="#demo{{$challenge->id}}" class="accordion-toggle">
<td><button class="btn btn-default btn-xs"><span class="glyphicon glyphicon-eye-open"></span></button></td>
<td>{{$challenge->c_sport_id}}</td>
<td>{{$challenge->c_gender_id}}</td>
<td>{{$challenge->c_location}}</td>
<td>{{$challenge->c_country_id}}</td>
<td>{{$challenge->c_state_id}}</td>
<td>{{$challenge->c_city_id}}</td>
<div colspan="12" class="hiddenRow"><div class="accordian-body
collapse" id="demo{{$challenge->id}}">
sport{{$challenge->c_sport_id}}
gender{{$challenge->c_gender_id}}
location{{$challenge->c_location}}
country{{$challenge->c_country_id}}
state{{$challenge->c_state_id}}
city{{$challenge->c_city_id}}
date{{$challenge->c_date}}
desc{{$challenge->c_desc}}
time{{$challenge->c_time}}
invite{{$challenge->c_invite}}
refree{{$challenge->c_refree_id}}</div>
<td><a rel="tooltip" title="" class="btn btn-simple btn-danger btn-icon table-action remove" href="javascript:void(0)" data-original-title="Remove"><i class="ti-pencil"></i></a>
<a rel="tooltip" title="" class="btn btn-simple btn-danger btn-icon table-action remove" href="javascript:void(0)" data-original-title="Remove"><i class="ti-close"></i></a>
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>sport_id
</th>
<th>gender_id
</th>
<th>location
</th>
<th>country
</th>
<th>state
</th>
<th>city
</th>
<th>action
</th>
</tr>
</tfoot>
</table>
运动Id
性别
地方
国
状态
城市
行动
@foreach($challenges作为$challenge)
{{$challenge->c_sport_id}
{{$challenge->c_gender_id}
{{$challenge->c_location}
{{$challenge->c_country_id}
{{$challenge->c_state_id}
{{$challenge->c_city_id}
运动{{$challenge->c_sport_id}
性别{{$challenge->c_性别{u id}
位置{{$challenge->c_location}
国家{$challenge->c_country_id}
状态{{$challenge->c_state_id}
城市{$challenge->c_city_id}
日期{{$challenge->c_date}
desc{{$challenge->c_desc}
时间{{$challenge->c_time}
邀请{{$challenge->c_invite}
refree{{$challenge->c_refree_id}
@endforeach
运动id
性别歧视
地方
国
状态
城市
行动
你能var\u dump
变量来查看你收到了什么吗?数组(4){[0]=>对象(App\Challenge){340(26){[“受保护的”:受保护的]=>数组(0){}[“连接”:受保护的]=>字符串(5)“mysql”[“表”:受保护的]=>字符串(10)我想你们不明白我的问题…在foreach循环中数据给出完美,但我想当按钮视图点击数据显示深入,等待我把图像放入问题-@sebasaenz