创建一个表以包含部分数据

时间:2014-09-14 21:20:13

标签: javascript jquery sharepoint datatable

我正在尝试使用一组变量并将信息添加到表中。我已经能够添加一个表来包含显示的所有信息,但是它不会将信息放入我想要查看的表中。这是初始看起来的样子(在这里新推出的图像):http://i.imgur.com/FxB8GMx.png - 红色框是我想要分成表格的信息。

使用soap功能从Sharepoint数据库中提取信息。我包括调用所有变量的地方:

function processResultOON(xData, status) 
{
    var result, subresult, outString="";
    var ListTemp = new Array();
    var ListUpdated = new Array();
    var floatlat;
    var floatlng;
    var floatlatdist;
    var floatlngdist;
    var floatdist;
    var floatdiststr;
    var titletxt;
    var biznametxt;
    var addresstxt;
    var citytxt;
    var phonetxt;
    var faxtxt;
    var websitetxt;
    var notestxt;
    var cleanstr;
    var ndx;
    var placendx;
    var swapped;
    var loopcnt;
    var maxndx;
    var tempbizname;
    var tempaddr;
    var tempcity;
    var temptitle;
    var tempphone;
    var tempfax;
    var tempnotes;
    var tempwebsite;
    var tempdist;
    var templat;
    var templon;
    var floattarglat;
    var floattarglon;
    var floatsamplat;
    var floatsamplon;
    var posel;
    var vccsel;
    var towltsel;
    var towmedsel;
    var towhvysel;
    var lowboysel;
    var dolliessel;
    var motorcyclesel;
    var tireltsel;
    var tiremedsel;
    var tirehvysel;
    var winchsel;
    var fuelsel;
    var lockssel;
    var locksmithsel;
    var jumpsel;
    var selOVN;
    var notesstage;
    var clearanceheight;
    var currentinsertptr;
    var currentlowdistptr;
    var lowdistcheck;
    var currentlowdist;
    var checkptr;
    var dropoutndx;

    var title_ndx = 0;
    var city_ndx = 1;
    var businessname_ndx = 2;
    var address_ndx = 3;
    var phone_ndx = 4;
    var fax_ndx = 5;
    var notes_ndx = 6;
    var lat_ndx = 7;
    var lon_ndx = 8;
    var website_ndx = 9;
    var po_ndx = 10;
    var vcc_ndx = 11;
    var lowboy_ndx = 12;
    var dollies_ndx = 13;
    var motorcycle_ndx = 14;
    var winch_ndx = 15;
    var fuel_ndx = 16;
    var locks_ndx = 17;
    var locksmith_ndx = 18;
    var jump_ndx = 19;
    var OVN_ndx = 20;
    var towlt_ndx = 21;
    var towmed_ndx = 22;
    var towhvy_ndx = 23;
    var tirelt_ndx = 24;
    var tiremed_ndx = 25;
    var tirehvy_ndx = 26;
    var clearance_ndx = 27;
    var dist_ndx = 28;

    var arrayndx;

    var addtolist;
    var addpin;


    var d2 = new Date();
    n2 = d2.getTime();



    var count = 0;

    try 
    {
        if (status == "success" && result)
        {
            $(result).find("rs\\:data").each(function() 
            {
                subresult = $(this);

                $(subresult).find("z\\:row").each(function()
                {
                    count++;
                    });

                ListI = new Array(count);
                for(var i=0;i<ListI.length;i++)
                {
                    ListI[i] = new Array(29); 
                    }

                var d2a1 = new Date();
                n2a1 = d2a1.getTime();

                arrayndx = 0;

                $(subresult).find("z\\:row").each(function()
                {
                    ListI[arrayndx][title_ndx] = $(this).attr("ows_Title")
                    ListI[arrayndx][city_ndx] = $(this).attr("ows_City")
                    ListI[arrayndx][businessname_ndx] = $(this).attr("ows_Business_x0020_Name")
                    ListI[arrayndx][address_ndx] = $(this).attr("ows_Address")
                    ListI[arrayndx][phone_ndx] = $(this).attr("ows_Phone")
                    ListI[arrayndx][fax_ndx] = $(this).attr("ows_Fax")
                    ListI[arrayndx][notes_ndx] = $(this).attr("ows_Notes")
                    ListI[arrayndx][lat_ndx] = $(this).attr("ows_Lat")
                    ListI[arrayndx][lon_ndx] = $(this).attr("ows_Lon")
                    ListI[arrayndx][website_ndx] = $(this).attr("ows_Website")
                    ListI[arrayndx][po_ndx] = $(this).attr("ows_PO")
                    ListI[arrayndx][vcc_ndx] = $(this).attr("ows_VCC")
                    ListI[arrayndx][lowboy_ndx] = $(this).attr("ows_Lowboy")
                    ListI[arrayndx][dollies_ndx] = $(this).attr("ows_Dollies")
                    ListI[arrayndx][motorcycle_ndx] = $(this).attr("ows_Motorcycle")
                    ListI[arrayndx][winch_ndx] = $(this).attr("ows_Winch")
                    ListI[arrayndx][fuel_ndx] = $(this).attr("ows_Fuel")
                    ListI[arrayndx][locks_ndx] = $(this).attr("ows_Locks")
                    ListI[arrayndx][locksmith_ndx] = $(this).attr("ows_Locksmith")
                    ListI[arrayndx][jump_ndx] = $(this).attr("ows_Jump")
                    ListI[arrayndx][OVN_ndx] = $(this).attr("ows_OVN")
                    ListI[arrayndx][towlt_ndx] = $(this).attr("ows_Tow_x0020_light")
                    ListI[arrayndx][towmed_ndx] = $(this).attr("ows_Tow_x0020_medium")
                    ListI[arrayndx][towhvy_ndx] = $(this).attr("ows_Tow_x0020_heavy")
                    ListI[arrayndx][tirelt_ndx] = $(this).attr("ows_Tires_x0020_light")
                    ListI[arrayndx][tiremed_ndx] = $(this).attr("ows_Tires_x0020_medium")
                    ListI[arrayndx][tirehvy_ndx] = $(this).attr("ows_Tires_x0020_heavy")
                    ListI[arrayndx][clearance_ndx] = $(this).attr("ows_Clearance")
                    ListI[arrayndx][dist_ndx] = 0.0;

                    arrayndx++;
                    }
                    );
                });


            arrayndx = 0;

            outheader="<tr>"
            for (j in ListI[0])
            {
                outheader = outheader + "<th>" + j +"</th>";
                }
            outheader = outheader + "</tr>"
            outString = outString + "<table>";

然后使用以下代码将信息显示在节目中,如上图所示。我希望将这些信息放入表中。问题是如何在不将上述不相关信息纳入表格的情况下将这些信息放在表格中?

posel = ListTemp[i][po_ndx];
vccsel = ListTemp[i][vcc_ndx];
towltsel = ListTemp[i][towlt_ndx];
towmedsel = ListTemp[i][towmed_ndx];
towhvysel = ListTemp[i][towhvy_ndx];
lowboysel = ListTemp[i][lowboy_ndx];
dolliessel = ListTemp[i][dollies_ndx];
motorcyclesel = ListTemp[i][motorcycle_ndx];
tireltsel = ListTemp[i][tirelt_ndx];
tiremedsel = ListTemp[i][tiremed_ndx];
tirehvysel = ListTemp[i][tirehvy_ndx];
winchsel = ListTemp[i][winch_ndx];
fuelsel = ListTemp[i][fuel_ndx];
lockssel = ListTemp[i][locks_ndx];
locksmithsel = ListTemp[i][locksmith_ndx];
jumpsel = ListTemp[i][jump_ndx];
selOVN = ListTemp[i][OVN_ndx];
clearanceheight = ListTemp[i][clearance_ndx];


notesstage = "";

if (posel == 1)
{
    notesstage = notesstage + "<strong>PO </strong>";
}
if (vccsel == 1)
{
    notesstage = notesstage + "VCC ";
}
if ((towltsel == 1) || (towmedsel == 1) || (towhvysel == 1))
{
    notesstage = notesstage + "<b>Tow</b>: ";
    if (towltsel == 1)
    {
        notesstage = notesstage + "<font color=#892EE4><b>LD </b></font>";
    }
    if (towmedsel == 1)
    {
        notesstage = notesstage + "<font color=#008080><b>MD </b></font>";
    }
    if (towhvysel == 1)
    {
        notesstage = notesstage + "<font color=#1FCB4A><b>HD </b></font>";
    }
}
if (lowboysel == 1)
{
    notesstage = notesstage + "Lowboy ";
}
if (dolliessel == 1)
{
    notesstage = notesstage + "Dollies ";
}
if (motorcyclesel == 1)
{
    notesstage = notesstage + "Motorcycle ";
}
if ((tireltsel == 1) || (tiremedsel == 1) || (tirehvysel == 1))
{
    notesstage = notesstage + "<b>Tires</b> ";
    if (tireltsel == 1)
    {
        notesstage = notesstage + "<font color=#892EE4><b>LD </b></font>";
    }
    if (tiremedsel == 1)
    {
        notesstage = notesstage + "<font color=#008080><b>MD </b></font>";
    }
    if (tirehvysel == 1)
    {
        notesstage = notesstage + "<font color=#1FCB4A><b>HD </b></font>";
    }
}

0 个答案:

没有答案