获取网格的行和列 [英] Get the rows and colums of grid

查看:108
本文介绍了获取网格的行和列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的网格,我想获取网格的行和列,并通过javascript获取每个单元格的值...



I am using the grid below and i want to get the rows and columns of the grid and also get the values of every cell through javascript...

@html.grid(model).columns(columns>RenderValueAs(o => @Html.CheckBox("checkBox", false));                                 
columns.Add(c => c.Name).Titled("BookName");                                  
columns.Add(c => c.Tittle).Titled("BookTittle");                                 
columns.Add(c => c.Author).Titled("BookAuthor");                               }).WithPaging(10).Sortable(true)

推荐答案

是Tadit是正确的。您可以将事件附加到复选框检查,并使用元素(复选框)访问选中复选框的特定行。您可以使用Jquery使用类似下面的内容: -



Yes Tadit is correct. You can attach an event to the checkbox check and with the element (checkbox) you can access the specific row where the checkbox is checked. You can use something like below using Jquery:-


(元素).target .closest(' tr');
// 获取行< tr> ..< / tr>
(element).target.closest('tr'); //Gets the row <tr>..</tr>


(element).target.closest(' tr')。 find(' td:eq(0)');
// 获取行的第一列< td> ..< / td>
(element).target.closest('tr').find('td:eq(0)'); //Gets the first column of row<td>..</td>





我希望你能得到这个。

请回复你的疑问。

谢谢。:)



I hope you get this.
Please post back your queries if any.
Thanks.:)


这篇关于获取网格的行和列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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