Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to display multiple user names in JQuery data table if multiple selection choice field is selected in list for Peoplepicker column

$
0
0

Hi Team,

I am retrieving the list data to a grid using Jquery datatable, if multiple selection choice field is selected in list for Peoplepicker column, data not coming in UserName field. Can someone correct this

Below is the JS code I am retriving the data 

$(document).ready(function () {
    loadData();
});

function loadData() {
    try {
        $.ajax({
            url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('testlist')/items?$select=Department,SiteURL,RequiredHours,Status,UserName/Title&$expand=UserName/Id",
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            success: function (result) {
                data = result.d.results;
                console.log(data);

                try {

                    $('#table_id').DataTable({

                        "aaData": data,
                        "aoColumns": [

                            {
                                "mData": "Department"
                            },
                            {
                                "mData": "SiteURL"
                            },
                            {
                                "mData": "RequiredHours"
                            },
                            {
                                "mData": "Status"
                            },
                            {
                                "mData": "UserName.Title"                             
                            }
                        ]
                    });
                } catch (e) {
                    alert(e.message);
                }             
            },
            error: function (error) {
                console.log(JSON.stringify(error));
            }
        });
    } catch (e) {
        console.log(e);
    }
}

I am getting the below error:

DataTables warning: table id=table_id - Requested unknown parameter 'UserName.Title' for row 0, column 4. For more information about this error, please see http://datatables.net/tn/4

                            

Ganesh


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>