SharePoint 2013中的Morris Charts实现 - 如何使用Json从Status字段获取数据?
亲爱的朋友们,
我正在尝试在SharePoint中实现Morris折线图,但我无法从状态(SharePoint下拉字段)获取数据。我想显示请求和已完成的项目数量,如下图所示。
I am trying to implement Morris Line Chart in SharePoint and I was not able to get the data from the Status(SharePoint Drop-down field). I want to show the number of items Requested and Completed as shown in the image below.
如上图所示,我想在给定日期显示已完成和已请求项目的计数。我正在使用字段
ID 来获取项目,但这不是我想要的实际数据。
As in the Image above, I want to show the count of Completed and Requested items on the given date. I was taking the field ID to get the items, but it was not the actual data I want.
请帮我找一个解决方案。
Kindly help me to find a solution.
谢谢
Hi Shajanhan,
Hi Shajanhan,
您可以使用Rest API根据日期过滤掉"状态"字段值,以获取请求/已完成项目的计数如下:
You could use Rest API to filter out the Status field value based on date to get the Requested/Completed items count like this:
<script type="text/javascript">
(document).ready(function(){
(document).ready(function(){
.ajax
({
url:_spPageContextInfo.webAbsoluteUrl +" / _ api / web / lists / GetByTitle('DemoList1')/ items?
.ajax ({ url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('DemoList1')/items?