Sharepoint Ajax列表数据填充器示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Sharepoint Ajax列表数据填充器示例相关的知识,希望对你有一定的参考价值。

  1. function btnSubmitEntry_OnClick() {
  2. $('#contentLoading').show();
  3. var ourProperty = EscapehtmlString($('#selProperty :selected').text());
  4. var ourAffectedUrl = EscapeHtmlString($('#selUrl :selected').text());
  5. var ourStagingUrl;
  6.  
  7. if (ourAffectedUrl.indexOf('/') == 0) {
  8. if (ourProperty.indexOf('MS.com') > -1) ourStagingUrl = "http://wwwstaging" + ourAffectedUrl;
  9. else if (ourProperty.indexOf('http://') > -1) ourStagingUrl = "http://standards" + ourAffectedUrl;
  10. else ourStagingUrl ="n/a";
  11. }
  12. else if ((ourAffectedUrl == "new page") || (ourProperty == "talkstandards.com")) ourStagingUrl ="to be determined" ;
  13. else ourStagingUrl ="n/a" ;
  14.  
  15. var updateString = "<Batch OnError="Continue">";
  16. updateString += "<Method ID="1" Cmd="New">";
  17. updateString += "<Field Name="ID">1</Field>";
  18. //updateString += "<Field Name="Title">" + EscapeHtmlString($("#txtTitle").val()) + "</Field>";
  19. updateString += "<Field Name="Title">Bug or Change Request </Field>";
  20. updateString += "<Field Name="Property">" + ourProperty + "</Field>";
  21. updateString += "<Field Name="Property_x0020_Owner">" + getPropertyOwner($('#selProperty :selected').text()) + "</Field>";
  22. updateString += "<Field Name="URL_x0020_Affected">" + ourAffectedUrl + "</Field>";
  23. updateString += "<Field Name="The_x0020_Requester">" + EscapeHtmlString($("#txtAuthor").val()) + "</Field>";
  24. updateString += "<Field Name="staging_x0020_url">" + ourStagingUrl + "</Field>";
  25. updateString += "<Field Name="Description">" + EscapeHtmlString($("#txtDescript").val()) + "</Field>";
  26. updateString += "<Field Name="Priority_x0020_Level">" + EscapeHtmlString($('#selPriority :selected').text()) + "</Field>";
  27. updateString += "<Field Name="Type_x0020_of_x0020_Request">" + EscapeHtmlString($('#selType :selected').text()) + "</Field>";
  28. updateString += "<Field Name="Go_x0020_Live_x0020_Date">" + EscapeHtmlString($("#txtGoLiveDate").val()) + "</Field>";
  29. updateString += "<Field Name="Go_x0020_Live_x0020_Time">" + EscapeHtmlString($("#txtGoLiveTime").val()) + "</Field>";
  30. updateString += "<Field Name="PageSection">" + EscapeHtmlString($("#txtSection").val()) + "</Field>";
  31.  
  32.  
  33.  
  34.  
  35.  
  36. updateString += "</Method>";
  37. updateString += "</Batch>";
  38. try {
  39. UpdateListItems("Change Requests", updateString, callback_Submit); }
  40. catch (err) {
  41.  
  42. alert(err.message);
  43.  
  44. }
  45. }
  46.  
  47.  
  48. function callback_Submit(respObj, status) {
  49. var soapError = SoapErrorCheck(respObj);
  50. if (soapError.length == 0) {
  51. if (respObj.xml.length > 0) {
  52. var rows = $("z\:row", respObj);
  53. requestID = trim($(rows[0]).attr("ows_ID"))
  54.  
  55. var editUrl = $("a#attachLink").attr("href") + "?ID=" + requestID;
  56. var attachmentUrl = $("a#custom-popup").attr("href") + "?ID=" + requestID;
  57.  
  58. $("a#attachLink").attr("href", editUrl );
  59.  
  60. $("a#custom-popup").attr("href", attachmentUrl );
  61.  
  62. $('#submittalConfirmation').show();
  63. $('#requestForm').hide();
  64. $('#contentLoading').hide();
  65. }
  66. else {
  67. alert("Error updating request list. Try again and if the error continues please contact your administrator.");
  68. }
  69. }
  70. else {
  71. alert("Error submitting your request: " + soapError);
  72. }
  73. }

以上是关于Sharepoint Ajax列表数据填充器示例的主要内容,如果未能解决你的问题,请参考以下文章

jquery用ajax方式从后台获取json数据后如何将内容填充到下拉列表

SharePoint REST API。在 SharePoint 列表上进行 AJAX 调用时出现 400 错误请求

JavaScript Sharepoint Ajax List Data populater示例

通过 ajax 使用实体数据库填充下拉列表

在 jQuery Mobile 中的 Ajax 调用中显示页面加载微调器

如何通过 ajax 使用数据库数据填充 ASP.NET MVC 4 下拉列表