简体   繁体   English

关闭模式对话框后,将行标记为已选中

[英]Mark row as selected after closing modal dialog

I have a table, with many rows. 我有一张桌子,有很多行。 From each row it is possible to open modal dialog with code (click on the first cell of the row), what I do with this code: 在每一行中,都可以使用代码打开模式对话框(单击该行的第一个单元格),然后执行以下代码:

var SetInventoryForAllCalendarsAndGroups = function () {

  var OpenModalGroup = function (element) {
          $("#myModalJEINVE_Group").modal();
  }


  return {
    OpenModalGroup: OpenModalGroup
  }      

  }();

What I don't know is how to select row after modal dialog is closed (same row where modal was opened from)? 我不知道如何在关闭模式对话框后选择行(从中打开模式的同一行)? So the row acts like it was clicked before opening modal dialog (in my case it's marked with yellow color). 因此,该行的行为就像在打开模式对话框之前被单击一样(在我的情况下,该行标记为黄色)。

Example is here 例子在这里

add

$(element).paremts('tr').addClass('active')

JS JS

var SetInventoryForAllCalendarsAndGroups = function () {

  var OpenModalGroup = function (element) {
          $(element).parents('tr').addClass('active'); // here it is
          $("#myModalJEINVE_Group").modal();
  }


  return {
    OpenModalGroup: OpenModalGroup
  }      

  }();

CSS 的CSS

.table tbody tr.active td {
    background-color: yellow;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 关闭后如何在jquery中重新打开模态对话框? - how to reopen modal dialog in jquery after closing it? 在显示模式对话框的按钮上设置的工具提示在关闭对话框后重新出现 - Tooltip set on a button displaying a modal dialog is reappearing after closing the dialog 关闭和重置模态对话框 - Closing and resetting a modal dialog 关闭 Bootstrap 模式对话框后,查看页面被锁定/禁用 - View page is locked/disabled after closing Bootstrap modal dialog 将模态对话框关闭到另一个模态对话框中 - Closing Modal Dialog into another Modal Dialog 为什么我在关闭第一个模态对话框后无法显示第二个模态对话框? - Why I'm not able to show second modal dialog after closing the first modal dialog? 如何重置或设置为默认选择<option>在<select>关闭模态后 - How to reset or set to default selected <option> in <select> after closing the modal 如何知道在jquery模式对话框中选择哪一行 - how to know which row is selected in jquery modal dialog box 关闭javaScript中的模式后,未添加表中的新行 - New row in table is not added after closing modal in javaScript 如何将表格行标记为已选择? - How to mark a table row as selected?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM