展开One Rows详细信息并折叠所有其他内容 [英] Expand One Rows Details And Collapse All Others

查看:80
本文介绍了展开One Rows详细信息并折叠所有其他内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要展开/折叠行详细信息,但想要调整它以在单击新行时折叠任何已打开的详细信息,以便一次只显示一行的详细信息。如果没有递归整个表,有没有一种有效的方法呢?我正在考虑将扩展行的ID存储在变量中,只需在单击新行时切换行并使用新行的ID更新变量,但我今天早上还没有足够的咖啡来弄清楚如何让这个工作。



如果你有任何疑问,请看这个例子:





http://www.modeltraintracker.com/sandbox/items.php

i想要这种类型的mvc 5

解决方案

您可以通过将您的行包裹在ajax的手风琴控件中来实现,也可以使用jquery ui手风琴。



通过选择以上给定方式之一可以一次显示一行并隐藏所有其他行。



手风琴是一个有几个窗格的手风琴,但一次只显示一个选定窗格的内容。


 @model List< testmvc4.data.country> 

@ {
ViewBag.Title =SearchView;

}



< script type =text / javascriptsrc =../../ Scripts / jquery-1.7。 1.min.js>

< / script>
< script type =text / javascript>

函数toggal(value,counts){


(document).ready(function(){
//用于展开点击行

To expand/collapse row details, but would like to tweak it to collapse any already open details when a new row is clicked, so that only one row's details are ever shown at a time. Without recursing through the entire table, is there an efficient way of doing this? I was thinking of storing the expanded row's ID in a variable, and just toggling the row when a new row is clicked and updating the variable with the new row's ID, but I haven't had enough coffee yet this morning to figure out how to make this work.

IF YOU HAVE ANY DOUBT SEE THIS EXAMPLE:


"http://www.modeltraintracker.com/sandbox/items.php"
i want this type in mvc 5

解决方案

You can do so by just wrapping your row in an accordion control of ajax or you can also use jquery ui accordion.

By choosing one of the above given ways you can display one row at a time and hide all others.

An accordion is the one which has several panes but displays the content of only one selected pane at a time.


@model List<testmvc4.data.country>

@{
    ViewBag.Title = "SearchView";
    
}



<script type="text/javascript" src="../../Scripts/jquery-1.7.1.min.js">

</script>
<script type="text/javascript">
   
    function toggal(value,counts) {


(document).ready(function () { //for expand clicked row


这篇关于展开One Rows详细信息并折叠所有其他内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆