简体   繁体   中英

how to detect a click of a grid inside an iframe?

I have to put a grid inside a iframe. I select a row then the detail is loaded in the main page hosting that frame. How to do?

An image is better than 1000 words. I want to reproduce a master-detail view like wufoo. The "black" grid is inside of the iframe. So the grid is always on top. Selecting a row, the detail page will be loaded on the back.

how to have a post on the main page when a row-clicked event fires in an iframed-grid, in asp.net mvc?

替代文字
(source: flickr.com )

Within the iframe:

The "top" variable (or window.top or self.top) should reference the main frame. You could use something like top.location = nextUri;

Alternatively there is a "target" attribute on links which can specify alternate frames. The link markup would be something like <a href="uri1" target="_top"> . You could forward click-events from the row to the link with document.getElementsByTagName("a")[0].click(), assuming that the link is the first one in the row. (The <base> element could also be used.)

Remember that replacing the main frame will require the iframe to be reloaded.

这不是您实际问题的答案,但是如果您使用大小正确的div和CSS为“ overflow:auto”,则可以得到相同的布局,而无需跨框架进行通信。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM