在datatable中有7000行,因此占用了大量的加载时间

时间:2015-10-16 10:53:26

标签: jquery sql-server-2008

这里我的Jquerygrid和存储过程实际上在数据表中有7000行所以占用了大量的加载时间,所以如何纠正那个加载。

    function Assemblys(){
            var asbyScript = mt, color = mt, colorIndex = 0;
            $.ajax({ type: post, cache: false, url: 'Default.aspx/Show_Eqpt_Asby_Part', data: "{'type':'ASBY','name':'" + $("#txtAsbyNameFilter").val() + "'}", contentType: cType, dataType: json,
                success: function (data) {
                    asbyScript = mt;
                    asbyScript += "<thead class='gridColorHeader'><tr style='color: White; font-weight: bold;height: 30px;' class='header'>";
                    asbyScript += "<th align='center' style='width:s%'>Assembly Code</th><th align='center' style='width:20%'>Assembly Name</th><th align='center' style='width:15%'>Item Category</th>";
                    asbyScript += "<th align='center' style='width:8%'>Calibration</th><th align='center' style='width:8%'>Condition</th><th align='center' style='width:8%'>Preventive</th><th align='center' style='width:5%'>Action</th></tr></thead>";
                    asbyScript += "<tbody>";
                    if (data.d.length > 0) {
                        for (var index = 0; index < data.d.length; index++) {
                            if (colorIndex == index) { color = "background-color:white"; colorIndex = colorIndex + 2; rowNum: 10; rowList: [10, 20, 30] } else { color = ''; }
                            asbyScript += "<tr style=" + color + "><td>" + data.d[index].ASBY_CODE + "</td><td class='titleCase'>" + data.d[index].ASBY_NAME + "</td><td align='center'>" + data.d[index].CATEGORY + "</td><td align='center'>" + data.d[index].CALIBRATION + "</td><td align='center'>" + data.d[index].CONDITION + "</td><td align='center'>" + data.d[index].PREVENTIVE + "</td>";
                            asbyScript += "<td align='center'> <button id='" + data.d[index].SPEC_ATTR_ID + "' type='button'>Edit</button></td></tr>";
                        } asbyScript += "</tbody>"; $('#tblAsby').html("").append(asbyScript); Get_Asby_Id('@&@', ","); $('#tblAsby').tablePagination({});
                    } else { asbyScript += "</tbody>"; asbyScript += "<tr><td align='center' colspan='7' style='color:red; font-weight:bold'> No Assemblys.</td></tr>"; $('#tblAsby').html(""); $("#tblAsby").append(asbyScript); }
                }, failure: function (response) { alert('Failure, Binding Assemblys.'); }, error: function (response) { alert('Error, Binding Assemblys.'); }
            });
        }

1 个答案:

答案 0 :(得分:0)

不知道这是否有帮助,但是,我在长时间装载的桌子上使用它。希望它有帮助..如果以后不保留它。

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2    
 /jquery.min.js" type="text/javascript"></script>
 <style>
 #dvLoading
 {
 background:#000 url(http://mfgweb.binney.com/manuf/all_data    
 /img/loader2.gif) no-repeat center center;
 height: 100px;
 width: 100px;
 position: fixed;
 z-index: 1000;
left: 50%;
top: 50%;
margin: -25px 0 0 -25px;
}

</style>

<script>
$(window).load(function(){
$('#dvLoading').fadeOut(500);
});
</script>
<div id="dvLoading"></div>