简体   繁体   English

我正在做一个打字稿项目,我试图让我的编辑按钮“编辑”我选择的行。 但我不知道该怎么做

[英]I am doing a typescript project and I am trying to make my edit button to “edit” the row that I have selected. But I have no idea on how to do it

That's my project.那是我的项目。

https://codepen.io/felipewolffo/pen/MWmQZLr https://codepen.io/felipewolffo/pen/MWmQZLr

I appreciate any help!我感谢任何帮助!

// HERE IS WHERE I AM TRYING TO IMPLEMNENT

  static editMedication(no) {
    if (no.classList.contains("btn-edit")) {
      const list = document.querySelector(
        "#medication-list"
      ) as HTMLTableElement;

      console.log(list);
    }
  }

I think a found a way to make it work.我认为找到了一种使其工作的方法。 But looks horrible, there are probably best ways to do that:但看起来很可怕,可能有最好的方法来做到这一点:

static editMedication(btn, no1?, no2?, no3?, no4?) {
    if (btn.classList.contains("btn-edit")) {
      const info1 = document.querySelector("#info1") as HTMLTableElement;
      const info2 = document.querySelector("#info2") as HTMLTableElement;
      const info3 = document.querySelector("#info3") as HTMLTableElement;
      const info4 = document.querySelector("#info4") as HTMLTableElement;
      no1 = info1.contentEditable = "true";
      no2 = info2.contentEditable = "true";
      no3 = info3.contentEditable = "true";
      no4 = info4.contentEditable = "true";
      alert("Select the table to Edit");
    }
  }

暂无
暂无

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

相关问题 MVC:如何确保我的字段在编辑表单的视图内选择了值? - MVC: How can I make sure that my field have the value selected inside my view on the edit form? 我对编辑功能有一个特别的想法 - I have a Special Idea about an Edit function 我正在尝试将华氏度转换为摄氏度,但它不起作用我做错了什么? - Javascript(需要有一个表格和一个清除按钮) - I am trying to convert Fahrenheit to Celsius but it's not working what am i doing wrong? - Javascript (needs to have a form and a clear button) 我正在尝试制作井字游戏,为此我必须解决这个问题: - I am trying to make a tic-tac-toe game and to do so I have to have solve this: 我正在尝试在 javascript 中制作一个简单的按钮来做两件事 - I am trying to make a simple button in javascript doing two stuff 我正在尝试对CRM模型进行单独的编辑和删除,但无法弄清楚如何将这些按钮与字段绑定 - I am trying to make seperate edit and delete on my CRM model but could not figure out how to bind those buttons with my field 使用flask-admin和sqlalchemy; 现在我试图做一个表格来添加/删除/编辑我的表 - using flask-admin and sqlalchemy; now i am trying to make a form to add/delete/edit my table 我正在用javascript做重力模拟器,而且我不知道如何进行碰撞工作 - I am making a gravity simulator in javascript, and I have no idea how to make a collision work 我想编辑我的产品列表时遇到问题,出现此错误无法读取null的属性“ title” - I have an issue when I want to edit my product list and i am getting this error Cannot read property 'title' of null 我在本地有一个 python 应用程序,我试图在我的网页上与 flask 进行交互。 我该怎么做呢? - I have a python app locally that I am trying to interact with on my webpage with flask. How do I do this?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM