Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
559 views
in Technique[技术] by (71.8m points)

html - 在表上单击按钮单元格不会仅将函数值返回到第一行(Button click on a table Cell doesn't return the function value to only first row)

I am new to react and html, we are currently developing a front page where in user can key in some values and based on which REST API (basically a backend service) would return the result.

(我是刚接触HTML的新手,我们目前正在开发一个首页,用户可以在其中键入一些值,并基于REST API(基本上是后端服务)返回结果。)

We are capturing this result onto a table with 7 columns.

(我们正在将此结果捕获到具有7列的表上。)

Last column ie, column 7 will have a button which on a click, will invoke another REST API with different params and result, should display a value and also give another button option.

(最后一列(即列7)将具有一个按钮,单击该按钮将调用具有不同参数和结果的另一个REST API,应显示一个值并提供另一个按钮选项。)

Currently I have below 2 issues:

(目前,我有以下2个问题:)

1) When I click the button on any row, always the text is being displayed only on column 7 of row 1 (even though my state variables show correct results).

(1)当我单击任意行上的按钮时,该文本始终仅显示在第1行的第7列上(即使我的状态变量显示正确的结果)。)

Not sure what might be the issue.

(不知道可能是什么问题。)

Can someone please point it out?

(有人可以指出吗?)

Code of column 5:

(第5栏的代码:)

<td>
  <className='xx' id='clm5'>
    <button className='yy' type='submit' value={identifier of the row} onclick=this.function()> Display</button>
    <p id='clm5' />
</td>

Function:

(功能:)

document.getElementById('clmn5').innerHTML = Text to display;

2) I need to have an additional reload button along with text as stated in point 1. How can I get this achieved?

(2)我需要一个额外的重新加载按钮以及第1点中所述的文本。如何实现此目的?)

Any help over these is much appreciated

(这些方面的任何帮助都将不胜感激)

  ask by ClarifyQuestions translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...