如何展示这个

How To Present This

数据

Name    Date    Span
Bob     12/11   0700-1530
Sue     12/11   0700-1530
Bob     12/12   0700-1530
Sue     12/12   0700-1530
Bob     12/13   0700-1530
Sue     12/13   0700-1530
Bob     12/14   0700-1530
Sue     12/14   0700-1530
Bob     12/15   0700-1530
Sue     12/15   0700-1530
Sue     12/16   1200-1830

如何将数据呈现如下,每人一行?

      Sun      Mon         Tue         Wed         Thu         Fri        Sat
     10DEC    11DEC       12DEC       13DEC       14DEC       15DEC      16DEC
Bob         0700-1530   0700-1530   0700-1530   0700-1530   0700-1530
Sue         0700-1530   0700-1530   0700-1530   0700-1530   0700-1530  1200-1830

同一个人在不同日子的跨度可能不同,并且任何给定一周的名字可能更多或更少。如果我没记错的话,这就是 Access 可以做到的 'cross-tab queries,' 的目的,但我不确定在 SharePoint 中。

没有一种开箱即用的方法。您可能需要做的是使用客户端呈现来更改视图的显示方式。这是一个更改视图呈现的 js 文件示例(没有实现您正在寻找的内容,但这是一个开始)。 customItem 函数是您定义每个单元格外观的地方。然后您可以在 post 渲染中操作结果。希望这能让你走上正确的道路。这是一份很好的 CSR 入门指南:https://www.codeproject.com/Articles/620110/SharePoint-Client-Side-Rendering-List-Views

(function () {
    // Initialize the variable that stores the objects.
    var overrideCtx = {};
    overrideCtx.Templates = {};

    // Assign functions or plain html strings to the templateset objects:
    // header, footer and item.
    overrideCtx.Templates.Header = "<B><#=ctx.ListTitle#></B>" +
        "<hr><ul id='unorderedlist'>";

    // This template is assigned to the CustomItem function.
    overrideCtx.Templates.Item = customItem;
    overrideCtx.Templates.Footer = "</ul>";

    // Set the template to the:
    //  Custom list definition ID
    //  Base view ID
    overrideCtx.BaseViewID = 2;
    overrideCtx.ListTemplateType = 10057;

    // Assign a function to handle the
    // PreRender and PostRender events
    overrideCtx.OnPreRender = preRenderHandler;
    overrideCtx.OnPostRender = postRenderHandler;

    // Register the template overrides.
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
})();

// This function builds the output for the item template.
// It uses the context object to access announcement data.
function customItem(ctx) {

    // Build a listitem entry for every announcement in the list.
    var ret = "<li>" + ctx.CurrentItem.Title + "</li>";
    return ret;
}

// The preRenderHandler attends the OnPreRender event
function preRenderHandler(ctx) {

    // Override the default title with user input.
    ctx.ListTitle = prompt("Type a title", ctx.ListTitle);
}

// The postRenderHandler attends the OnPostRender event
function postRenderHandler(ctx) {

    // You can manipulate the DOM in the postRender event
    var ulObj;
    var i, j;

    ulObj = document.getElementById("unorderedlist");

    // Reverse order the list.
    for (i = 1; i < ulObj.children.length; i++) {
        var x = ulObj.children[i];
        for (j = 1; j < ulObj.children.length; j++) {
            var y = ulObj.children[j];
            if(x.innerText<y.innerText){                  
                ulObj.insertBefore(y, x);
            }
        }
    }
}