How to create nested ng-repeat from a SharePoint 2013 list item

时间:2018-06-04 17:15:52

标签: angularjs sharepoint-2013

I have an excel sheet containing data with a little bit over 4k entries. I loaded the data into SharePoint 2013 list. The relation that exist between the data are FUID and RiskAreaID. I want to categorize the the data from the SharePoint 2013 list by there RiskAreaID been the parent while the FUID will be the child. The concept I want to replicate is a nested FAQ list.

Below is the service responsible for getting the data from the SharePoint list

    // FSU: this only create the item
    function getFSUItems(){
        var deferred = $q.defer();

        var siteUrl = "https://teamsite.mydigitalhangout.net/FSU";

        $http({
            method: 'GET',
            url: siteUrl + "/_api/web/lists/GetByTitle(\'FSUList\')/items?$top=1000&$orderby=Created desc",
            headers: {
                "accept": "application/json; odata=verbose",
                //"content-type": "application/json; odata=verbose",
            }
        }).success(function(data) {
            deferred.resolve(data.d.results);
        }).error(function(error) {
            var message = "data context ngHttp error: " + error.message;
            deferred.reject(message);

        });

        return deferred.promise;
    }

The view renders all the data as depicted below:

    <table id="example" class="table table-striped table-bordered table-hover col-sm-12">
        <thead>
            <tr>
                <th>Surname</th>
                <th>First Name</th>
                <th>IsFU Head</th>
                <th>FUID</th>
                <th>RiskAreaID</th>
                <th>Location</th>
                <th>Created</th>
            </tr>
        </thead>
        <tbody>
            <tr data-ng-repeat="feedback in addFSU.item | startFrom: addFSU.pagination.page * addFSU.pagination.perPage | limitTo: addFSU.pagination.perPage" >
                <td>{{feedback.Surname}}</td>
                <td>{{feedback.FirstName}}</td> 
                <td>{{feedback.IsFUHead}}</td>
                <td>{{feedback.FUID}}</td>
                <td>{{feedback.RiskAreaID}}</td>                  
                <td>{{feedback.Location}}</td>
                <td data-ng-bind-html="feedback.Created"></td>
            </tr>
        </tbody>
    </table>

I want to display the data such that the FUID will be the parent while the others will be the child element.

0 个答案:

没有答案