[英]How can i display the table row that just got clicked, on another page?
I'm working on a website where you can see buildings on a map and where users can click on a table row ( 1 ) (where informations about the building is shown) to get redirected to the map page.我正在一个网站上工作,您可以在该网站上看到 map 上的建筑物,并且用户可以在其中单击表格行 ( 1 )(显示有关建筑物的信息)以重定向到 map 页面。 Additionally, and thats where i'm stuck, the clicked table row should appear on the first page ( 2 ).
此外,这就是我被卡住的地方,点击的表格行应该出现在第一页( 2 )上。
So the question is: how can i display the table row that just got clicked, on another page?所以问题是:我怎样才能在另一个页面上显示刚刚被点击的表格行?
thanks for your help!感谢您的帮助!
Pass the index of the row that is clicked as props将被点击的行的索引作为道具传递
Even if it's difficult to answer to this question since it's very generic, I'll try to assume that you are missing the basic approach and need a starting point on how resolve this.即使很难回答这个问题,因为它非常通用,我会尝试假设您缺少基本方法,并且需要一个关于如何解决这个问题的起点。 Once you clicked on the row, you can pass the data to the new URL.
单击该行后,您可以将数据传递给新的 URL。 Assuming that you are calling a new page, the row should be wrapped in an anchor element and in this case the data can be passed with a GET request, included in the URL.
假设您正在调用一个新页面,该行应该包含在一个锚元素中,在这种情况下,数据可以通过 GET 请求传递,包括在 URL 中。 You can have a look to the W3school website page talking about GET method to learn more about it.
您可以查看W3school 网站页面,了解有关 GET 方法的更多信息。 If you are trying to do this as a single page application with react instead, start looking at React documentation on how components and props work to pass props down to other components.
如果您尝试将其作为单页应用程序来代替,请开始查看 React 文档,了解组件和道具如何工作以将道具传递给其他组件。 Hope you find this helpful!
希望你觉得这有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.