javascript - trouble querying 2 different lists from a SharePoint welcome page using ECMA -
my approach not working here. on welcome page of sharepoint 2010 document set , have placed script in content editor web part cewp. i've got block of jquery/javascript using following code. can 1 or other set of values 2 different blocks of code not both. seems duplicating of lines of code in tow queries causes things clash not sure can change make both sets unique or clashing between two. guidance appreciated. i'm going in circles right now. -dave
i using 2 blocks differ @ listname. maybe page can support 1 of these?
$(document).ready(function () { $().spservices({ operation: "getlistitems", async: false, camlrowlimit: 2000, listname: "personnel management", completefunc: fncallback }); }); function fncallback(xdata, status) { var index = 0; $documentlisttable = $("#documentlisttable"); //navigate through xml $(xdata.responsexml).find("z\\:row, row").each(function () { //get values local variable var _url = $(this).attr("ows_fileref").split(";#")[1]; var _name = $(this).attr("ows_linkfilename"); ; var _author = $(this).attr("ows_editor").split(";#")[1]; var modifiedon = $(this).attr("ows_modified"); var _trainingstatus = $(this).attr("ows_training_x0020_certificates"); //create clone of table row var $row = $("#templates").find(".row-template").clone(); //add values column based on css class $row.find(".documentname").html(_pdflink); $row.find(".author").html(_author); $row.find(".lastmodifiedon").html(modifiedon); $row.find(".trainingstatus").html(_trainingstatus); //change style rows if (index % 2 == 0) { $row.addclass("jtable-row-even") } if (_trainingstatus.indexof("1001") !=-1) { index = index + 1; //add row table $documentlisttable.append($row); } -
you can try adding both spservices calls inside 1 $(document).ready instead of having 2 $(document).ready blocks. there can multiple $(document).ready in page issue sounds 1 spservice call triggered on page load.
Comments
Post a Comment