开发者

How to apply pagination in IFrame

I have an IFram开发者_开发百科e with a Table enclosed within it. I want to display 15 rows of a table and than a Next button must be there to move forward.

How to apply pagination for IFrame?


This is essentially answered in Basic jQuery question: How to change iframe src by clicking a link?.

You would just need to build GET parameters for the frame source, and build links for each of the values in the main page.

For example:

<a href="foo.html?page=1" target="myiframe">Page 1</a>
<a href="foo.html?page=2" target="myiframe">Page 2</a>
<a href="foo.html?page=3" target="myiframe">Page 3</a>

<iframe name="myiframe"></iframe>

The catch is that your main page will need to know the status of the frame to generate the right links -- this will require some javascript parsing of the frame source URL and regenerating the links based on that.

Instead of using a frame, I would recommend loading the whole table inside the main page and using something like DataTables to generate the pagination for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜