0 Replies - 704 Views - Last Post: 11 April 2012 - 11:08 AM

#1 vmicchia   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 20-January 12

Help with data display

Posted 11 April 2012 - 11:08 AM

I'm trying to display some data in a table form with each table on a new tab with jquery UI. The tabs work just fine but I have an issue with the data. I'm taking if from an xml sheet. so the first table will display perfect, however the second table will have the the first table's data at the top.

Here's the code:
function loadAcct(acctid,acctName){
                //removes the current li elements from our list before making new ones.



                $("#title-name").append(" - "+acctName);

                //ajax call to the server to get the needed information.

                $.ajax({

                    url: "/_admin_/"+ acctid + "-grps.xml",

                    contentType: "xml",

                    type: "GET",

                    async: false,

                    success: function(xml){

                        //loop to find the name of the <SavedCart> elements

                        $("#demo").append('<div id="tabs"><ul></ul></div>');

                        $(xml).find('SavedCart').each(function(){

                            $(this).find("Name").each(function(){

                                groupName = $(this).text();

                                groupNameUp = groupName.toUpperCase(groupName);

                                // We only want to output the groups that have CRIB in the name

                                if(groupNameUp.indexOf("CRIB") != -1){

                                    $("ul").append("<li><a href=\"#tabs-" + p + "\">" + groupName + "<\/a><\/li>");

                                    $(this).parent().find('ItemList').each(function(){

                                        $(this).find('Item').each(function(){

                                            partNums.push( $('PartNumber',this).text())

                                            descs.push( $('Description',this).text())

                                            //cpns.push( $('CustomerPartNumber',this).text())

                                        })

                                    })

                                    for(c=0;c<partNums.length;c++){
                                        for(d=0;d<pn.length;d++){
                                            if(partNums[c] == pn[d]){
                                                cpns1[c] = cpns[d];
                                                mins1[c] = mins[d];
                                                maxs1[c] = maxs[d];
                                                boxqtys1[c] = boxqtys[d];
                                                break;
                                            }else{
                                                cpns1[c] = "";
                                                mins1[c] = "";
                                                maxs1[c] = "";
                                                boxqtys1[c] = "";
                                            }
                                        }
                                    }
                                  
                                    if (partNums.length > 0){

                                        var table = '<div id="tabs-' + p + '" class = remove><form id="orderform' + p + '" name="orderform' + p + '" action="order.php" method="POST" enctype="multipart/form-data" onsubmit="return checkpo(' + acctid + ', ' + p + ')"><table border="1" cellpadding="10" name="mytable' + p + '" id="mytable' + p + '" class="sortable"><thead><tr><th>On Hand<\/th><th>Eclipse ID<\/th><th>Customer Part Number<\/th><th>Description<\/th><th>Minimum<\/th><th>Maximum<\/th><\/th><th>Box Qty<\/th><th>Amount to Order<\/th><th>Select For Order<\/th><\/tr><\/thead><tbody id="maintablebody" >';

                                        for(l=0;l<partNums.length;l++){

                                            table += '<tr><td><input type="text" id="onhand' + l + '" class="onhand' + l + '" size="5" onchange="autocheckbox(' + l + ')"></td><td>' + partNums[l] + '<\/td><td>' + cpns1[l] + '<\/td><td>' + descs[l] + '<\/td><td class="min' + l + '">' + mins1[l] + '<\/td><td class="max' + l + '">' + maxs1[l] + '<\/td><td class="bxqty' + l + '">' + boxqtys1[l] + '<\/td><td class="tdamt'+ l +'"><input type="text" name="amt[]" id="amt[]" class="amt' + l +'" size="6" onchange="chkfrmamt(' + l + ')" /><\/td><td style="text-align: center;"><input type="checkbox" name="check[]" id="check[]" value="' + partNums[l] + '" class="check' + l +'" onclick="autofill(' + l + ')" /><\/td><\/tr>';

                                        }

                                        table += '<tr><td colspan="8"><label>PO Number:<\/label><input type="text" id="PO" name="PO" class="PO' + p + '" width="20" \/><\/td><\/tr><\/tbody><\/table><div id="submit"><input type="submit" id="sub" value="Order" /><input type="reset" value="Reset" name="reset" /></div><input type="hidden" id="SessID" value="' + sessID + '" name="SessID" \/><input type="hidden" id="eID" value="' + acctid + '" name="eID" \/><\/form><\/div>';

                                        $("#tabs").append(table);

                                        p++;

                                        m = p;

                                    }

                                }

                            })
                           
                        })

                    }

                })
                for(q=0;q<=m;q++){
                    $("table#mytable" + q + " tr:odd").addClass("alt");
                }
               
                $( "#tabs" ).tabs();
            }


I would appreciate it very much if someone could point me in the right direction.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1