开发者

Sorting/filtering a javascript-created list in a SharePoint content editor

I'm working in SharePoint 2010, and I have a list that I want to display a very specific way. Basically, I'm using Javascript, jquery, and SPServices to query the list and build a table in a content editor web part with links differing dependent on login name and request status. Okay, so that works, but now I'm trying to sort/filter the Javascript-generated table, and it's no soup for me.

I tried a few different Javascripts that sort and filter, and this one seems to be the one that does what I need: http://www.javascripttoolbox.com/lib/table It does work if I create an HTML table in the content editor web part, but if the table's not present on page load that's where the issues start arising.

Any help or suggestions are much appreciated.

Here's a few snippets of code:

<table class="table-autosort table-autofilter" id="openReqTable" bordercolor="#000000" border="1" cellspacing="0" cellpadding="5">
<thead>
    <tr>
        <th class="table-sortable:numeric table-filterable">Request ID</th>
        <th>
...
        </th>
        <th>Request Status</th>
    </tr>
</thead>
<tbody></tbody></table>
<script src="/Utilities/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/Utilities/jquery.SPServices-0.5.7.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var tableRowCount = 1;
    var query;
...

    $(document).ready(function()
    {
        currentUserVar = $().SPServices.SPGetCurrentUser({
            fieldName: "UserName",
            debug: false
        });

...

    var groupCollectionVar = $().SPServices({
                                operation: "GetGroupCollectionFromUser",
                                userLoginName: currentUserVar,
                                completefunc: groupTestFunc
                                });
});

function groupTestFunc(xData,status)
{
...
        newRow=document.getElementById('openReqTable').insertRow(tableRowCount);
        newTableColumnA=newRow.insertCell(0);
...
        newTableColumnK=newRow.insertCell(10);
...
        newTableColumnA.innerHTML=requestIDLink;
...
        newTableColumnK.innerHTML=requestStatus;
        tableRowCount++;
    });
}</script><script src="/Utilities/开发者_高级运维table.js" type="text/javascript"></script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜