如何增加在的jqGrid按钮/图像的一个新的列 [英] How to add a new column of buttons/images in jqgrid

查看:131
本文介绍了如何增加在的jqGrid按钮/图像的一个新的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.net MVC的Web应用程序中使用的jqGrid。

I am using JQgrid in ASP.net MVC web application .

我能够通过使用格式化添加名为编辑按钮的新列

但是,问题是,我是不能够得到在被点击的量,按钮行中的列的值。

But, the problem is i was not able to get the value of a column in a row for which the button is clicked.

例如,如果我点击编辑按钮(新增)在第4行,我需要获取特定行的第一列的值。

For example, if i click button edit ( new added) on 4th row, i would require to fetch the value of first column of that particular row.

我需要这个怎么一回事,因为我想重定向到与价值的另一页,做编辑那里。

i need this beacuse i want to redirect to another page with that value and do the edit there.

我无法获取该值,并添加JavaScript到它。

I was not able to fetch that value and add javascript to it.

请在此帮助任何code样品。

Please help on this with any code samples..

推荐答案

您不需要绑定点击事件处理程序的每个的按钮在列。每结合取存储器和网络浏览器的其他资源。最赛事由内至外的DOM元素冒泡(见这里),鼠标点击,键盘的keydown,触摸touchstart并在网格内的按钮等事件将是泡到网格的&LT;表&gt; 元素。默认的jqGrid注册点击网格事件处理程序。它调用 beforeSelectRow onCellSelect 回调和触发 jqGridBeforeSelectRow jqGridCellSelect 从事件处理事件。因此,而不是结合自己的点击每个按钮事件处理程序就足够使用一个从上面的回调或事件列出。 beforeSelectRow (或 jqGridBeforeSelectRow )将首先使用。回调是实际的,如果你什么点击按钮不要选择相应的行。 例如答案显示如何验证是否您需要的被称为列。 另一个答案介绍,这将是非常接近你所需要的一个例子。 还有一个答案给你另一个code片段。要查看有关的主题,您可以使用<更为我的老答案href=\"http://stackoverflow.com/search?q=user:315935%20%5Bjqgrid%5D%20%2bonCellSelect%20%2bbeforeSelectRow%20\">the下面的查询。

You don't need to bind click event handler to every button in the column. Every binding take memory and other resources of web browser. The most events bubbling to from inner to outer DOM element (see here), Mouse click, Keyboard keydown, Touch touchstart and other events on the button inside of grid will be bubble to the grid's <table> element. jqGrid register by default click event handler on the grid. It calls beforeSelectRow and onCellSelect callbacks and trigger jqGridBeforeSelectRow and jqGridCellSelect events from the event handler. So instead of binding your own click event handlers on every button it's enough to use one from listed above callbacks or events. beforeSelectRow (or jqGridBeforeSelectRow) will be used first. The callback is practical if you what that click on the button don't select the corresponding row. The answer for example shows how to verify whether the column which you needs are called. Another answer provides an example which will be very close to what you need. One more answer gives you another code fragment. To see more my old answers about the subject you can use the following query.

更新时间::演示 http://jsfiddle.net/ShKDX/82/ 是发表曼努埃尔面包车Rijn的演示进行修改。它展示了我的意思。

UPDATED: the demo http://jsfiddle.net/ShKDX/82/ is modification of the demo posted by Manuel van Rijn. It demonstrates what I mean.

这篇关于如何增加在的jqGrid按钮/图像的一个新的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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