简体   繁体   English

使用服务调用从共享点列表数据中获取数据并显示在html表中,一切正常,但一个javascript失败

[英]Using service call getting data from sharepoint list data and displaying in html table, everything is working but one javascript is failing

I am not a developer but occassionaly I have to edit and/or develop sites. 我不是开发人员,但有时我必须编辑和/或开发网站。 I have libraries of scripts that I just edit some code and everything works fine. 我有一些脚本库,我只需编辑一些代码即可,并且一切正常。 But right now I am having a issue: In my sharepoint list I have begin and end date. 但是现在我遇到了一个问题:在共享点列表中,我有开始和结束日期。 Using sharepoint desinger I was able to calculate month difference between those two dates. 使用sharepoint desinger,我能够计算出这两个日期之间的月份差。 Till this point it is working fine. 到此为止,它工作正常。 I also need to display a status like - if month > some month do this. 我还需要显示一个状态,例如-如果month> some month,请执行此操作。 Below is my code, I know it is the javascript but I couldn't figure out what. 下面是我的代码,我知道它是JavaScript,但我不知道是什么。 Any sort of help or information will be highly appreciated. 任何帮助或信息将不胜感激。

function getMyListDataCallback(xData){  
  -------------  
}
var month = (year2-year1)*12+(month2-month1)-1;  
var status = (function forwardback(fb){  
  if (fb > 45) {console.log("move forward");}  
  else if (fb <25 && fb > 0) {console.log("stay where you at");}  
  else if (fb <45 && fb > 30) {console.log("move backward");}  
})  
 forwardback(month);  
 AddRowToTable(title,report,beginmonth,endmonth,month,status);

Every other data is displaying correctly in html table but the status column. 除status列外,所有其他数据均在html表中正确显示。 It is displaying all codes in function instead of "move forward" and so on. 它正在显示功能中的所有代码,而不是“前进”等等。

It looks like you're setting the status variable to be equal to the forwardback function definition. 看起来您正在将status变量设置为等于forwardback函数定义。

You probably want to set it equal to the return value from the forwardback function. 您可能希望将其设置为等于forwardback函数的返回值

var status = forwardback(month);
AddRowToTable(title,report,beginmonth,endmonth,month,status);
function forwardback(fb){  
  if (fb > 45) { return "move forward";}  
  else if (fb <25 && fb > 0) { return "stay where you at";}  
  else if (fb <45 && fb > 30) { return "move backward";}  
};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JavaScript从Sharepoint 2013获取列表数据 - Getting List data from Sharepoint 2013 using javascript 使用javascript将HTML数据插入SharePoint列表 - Inserting html data to SharePoint list using javascript 使用JavaScript访问普通HTML页面中的Sharepoint列表数据 - Accessing Sharepoint list data in a normal HTML page using JavaScript 使用JavaScript和jQuery获取超链接字段/列以从SharePoint列表中将数据显示为超链接 - Getting a hyperlink field/column to display data as a hyperlink from a SharePoint List, using JavaScript and jQuery 用javascript创建的列表未显示html元素的列表数据 - list created with javascript is not displaying list data from html element 使用AJAX调用从Web服务添加数据并在HTML页面中显示到数据表中 - Add data and display into data table in HTML page from web service using AJAX call 来自 SharePoint 的数据被拉入 HTML 表,然后被导出到 word,该表未完全显示 - Data from SharePoint is being pulled into a HTML table and then its being exported to word, the table is not displaying fully 使用 Jquery 从 SharePoint 2010 站点获取列表数据 - Getting list data from SharePoint 2010 site using Jquery Javascript 表使用来自多个 txt 文件的数据并显示在 html 文件上 - Javascript table using data from multiple txt files and displaying on html file 使用for循环在基本html表中显示来自服务器的json数据,仅javascript,for循环有问题吗? - Displaying json data from server in basic html table using for loop, javascript only, problem with for loop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM