在listview中显示/隐藏td [英] show/ hide td inside listview

查看:73
本文介绍了在listview中显示/隐藏td的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



在列表视图中,我有表包含[id,name,grade,age,notes]

notes field显示为一行,默认情况下隐藏。

我添加了一个名为show / hide notes的新列。在此列中,当用户单击它时会显示一个链接,它将显示或隐藏注释行。所以表格看起来像这样[id,名称,等级,年龄,演出笔记,笔记]

td看起来像这样

 <   td     colspan   =  4   样式  =  display:none ;    id   =  notesTd    class   =  showHideNotes > 备注<   / td  >  





链接如下:



< pre lang =HTML> < td style = text-align:center; vertical -align:middle; > < a href = > < img src = img / notes1.png = wiringImg / > < / a > < / td >





onclick锚点我有这个JavaScript代码:

 onclick =   $('。showHideNotes')。toggle(); 





问题是如果我在javaScript代码中使用类名,它将显示/隐藏表的所有注释,如果我使用td的Id,它将仅显示/隐藏第一行。

我需要添加什么来使锚点显示/隐藏行的音符而不是所有行。



我希望我能很好地解释我的问题。



谢谢

解决方案

(' .showHideNotes')。toggle();





问题是如果我在javaScript Code中使用类名,它将显示/隐藏表格的所有注释,如果我使用td的ID,它将仅显示/隐藏第一行。

我需要添加什么来使锚点显示/隐藏行的注释不是所有的行。



我希望我能很好地解释我的问题。



谢谢


我找到了解决方案,我不得不寻找td的父级

所以我将javaScript更改为:

 onclick =   


(this)。 。父()的父()next()的发现( '#notesTd')切换(); ...


Hello Experts,

In a listview I have table contains [id, name, grade, age, notes]
notes field is displayed as a row and it's hidden by default.
I added new column called show/hide notes. in this column there's a link when the user clicks it will show or hide the notes row. so the table will look like this [id, name, grade, age,show notes, notes]
the td looks like this

<td colspan="4" style="display:none;" id="notesTd" class="showHideNotes">Notes</td>



the link looks like this :

<td style="text-align:center;vertical-align:middle;"><a href="#"><img src="img/notes1.png" class="wiringImg"  /></a></td>



Onclick of the anchor I have this JavaScript Code:

onclick="$('.showHideNotes').toggle();" 



The problem is If I use the class name in javaScript Code, it will show/hide all the notes of the table and If I use the Id of the td it will show/hide the first row only.
What I need to add to make the anchor show/hide the note of the row not all the rows.

I hope I well explained my problem.

Thank you

解决方案

('.showHideNotes').toggle();"



The problem is If I use the class name in javaScript Code, it will show/hide all the notes of the table and If I use the Id of the td it will show/hide the first row only.
What I need to add to make the anchor show/hide the note of the row not all the rows.

I hope I well explained my problem.

Thank you


I found the solution, I had to look for the parent of the td
So I changed javaScript to :

onclick="


(this).parent().parent().next().find('#notesTd').toggle();"


这篇关于在listview中显示/隐藏td的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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