如何动态获取表格数据并附加到新的DIV [英] How to dynamically get tabular data and and append to a new DIV
本文介绍了如何动态获取表格数据并附加到新的DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码将一个表从服务器控件-'PivotGridDiv'复制到div - 'copymygrid',但有些如何不起作用。有人可以分析一下,告诉我哪里出错了。
I have used the following code to copy a table from a server control-'PivotGridDiv' to a div - 'copymygrid', but some how it doesn't work. Could someone please Analyse it, tell me where am I going wrong.
<%--Code to goto new page on scroll when all option is selected--%>
<script type="text/javascript">
var x = 1;
$(document).ready(function ()
{
if ($('#ContentPlaceHolder1_ddlPageSize').find('option:selected').text().toString() == '15'.toString())
{
copycontent();
$('#PivotGridDiv').bind('scroll', function ()
{
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight)
{
ScrollBottom();
}
});
$('#CopyMyGrid').bind('scroll', function ()
{
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight)
{
ScrollBottom();
}
});
}
});
//Required Functions for ScrollBottom and appending result to data
function ScrollBottom()
{
copycontent();
ClickNext();
}
function ClickNext()
{
pivotGrid_PagerClick('ctl00_ContentPlaceHolder1_ASPxPivotGrid1', this, 'PBN'); // perform click programatically on the control and load new records
}
function copycontent()
{
var source = document.getElementById
"ctl00_ContentPlaceHolder1_ASPxPivotGrid1_HZST").rows;
$("#CopyMyGrid").append('<table>').append(source).append('</table>');
var hasFocus = $('#CopyMyGrid').is(':focus');
if (hasFocus && x==1)
{
$("#CopyTable").css('z-index', 999);
x = 0;
}
}
</script>
<%--Code Ends here--%>
推荐答案
( document )。ready( function ()
{
if (
(document).ready(function () { if (
(' #ContentPlaceHolder1_ddlPageSize')。find(' 选项:选中')。 text()。toString()== ' 15' .toString())
{
copycontent();
('#ContentPlaceHolder1_ddlPageSize').find('option:selected').text().toString() == '15'.toString()) { copycontent();
(' #PivotGridDiv')。bind(' scroll', function ()
{
if (
('#PivotGridDiv').bind('scroll', function () { if (
这篇关于如何动态获取表格数据并附加到新的DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文