Flexigrid - 如何关闭行选择

发布于 2024-08-22 09:53:25 字数 261 浏览 3 评论 0原文

是否可以关闭 Flexigrid 上的行选择功能? 当您没有实现任何使用该选择的内容时,这有点烦人。

替代文本

Is it possible to turn off the row selection feature on Flexigrid?
It's somewhat annoying when you haven't implemented anything that makes use of the selection.

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

╰ゝ天使的微笑 2024-08-29 09:53:25

不幸的是,Flibble 先生接受的答案并没有停止所有选择功能,它只是将其限制为一行。
要完全禁用它,请向 $.extend 块添加一个新属性(第 20 行左右),

// apply default properties
p = $.extend({
<SNIP>
onSubmit: false, // using a custom populate function
disableSelect: true

然后在该行的 .click 部分(第 754 行左右)添加对该属性的检查

$(this)
.click(
 function (e)
 {
  var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true;
  if (p.disableSelect) return true;
  $(this).toggleClass('trSelected');
  if (p.singleSelect) $(this).siblings().removeClass('trSelected');
 }
)

Unfortunately Mr Flibble's accepted answer does not stop all selection capability, it merely restricts it to one row.
To disable it completely, add a new property to the $.extend block (around line 20)

// apply default properties
p = $.extend({
<SNIP>
onSubmit: false, // using a custom populate function
disableSelect: true

Then in the .click section of the row (around line 754) add a check for the property

$(this)
.click(
 function (e)
 {
  var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true;
  if (p.disableSelect) return true;
  $(this).toggleClass('trSelected');
  if (p.singleSelect) $(this).siblings().removeClass('trSelected');
 }
)
冷了相思 2024-08-29 09:53:25

结果您需要将 singleSelect 属性更改为 true。

singleSelect: true

Turns out you need to change the singleSelect property to true.

singleSelect: true
静谧 2024-08-29 09:53:25

我知道这个线程有点旧,但我发现它正在寻找同样的东西。 singleSelect 对我不起作用,因为我不想选择任何行。我发现我可以用一行代码删除任何行选择:

$('.grid tr').unbind('click');

这门课程删除表行上的所有绑定,因此如果您需要绑定,除非您稍后重新绑定,否则您将不会拥有它,但我需要删除所有绑定我的桌子上的行选择。我不需要接触 flexigrid 代码来做到这一点,我比以前的答案更喜欢一点。

I know this thread is a bit old but I came upon it looking for the same thing. The singleSelect didn't work for me as I didn't want to be able to select any row. I found that I could remove any row selection with a single line of code:

$('.grid tr').unbind('click');

This a course removes all bindings on the table row so if you needed the binding you won't have it unless you rebind later but I needed to remove any and all row selection on my table. I didn't need to touch the flexigrid code to do so which I liked a bit more than previous answers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文