Can Datatables ignore '__deferred' entries in JSON?

Can Datatables ignore '__deferred' entries in JSON?

macxpertmacxpert Posts: 1Questions: 1Answers: 0

Hi

I am new to DataTables, but i have searched and read the documentation and not found an answer. Apologies if i'm missing something.

Can Datatables ignore defered entries in JSON?

Here is a sample of my JSON showing two results. This first result returns the 'CompanyLookup1.Company' value. "Company": "Acme Widgets" The second result shows a deferred entry, because this item is blank in the underlying database (Sharepoint 2013):

{
  "d": {
    "results": [
      {
        "__metadata": {
          "id": "f0c84d12-82c1-480d-9a1f-98fc7e634d46",
          "uri": "https://xxxxxxxxxxxxxxxxxxxx/_api/Web/Lists(guid'd60b3a5b-e7e8-4d96-9b7e-6603ebf98903')/Items(19445)",
          "etag": "\"4\"",
          "type": "SP.Data.ArchivedProjectsListItem"
        },
        "ProjStatusLookup": {
          "__metadata": {
            "id": "654aca68-2d88-4904-a5d1-062bc55a2aad",
            "type": "SP.Data.ProjectStatusListItem"
          },
          "ProjStatusOptions": "Lost"
        },
        "CompanyLookup1": {
          "__metadata": {
            "id": "3549b316-dde4-4494-ab45-6bd5fcb8533c",
            "type": "SP.Data.CompaniesListItem"
          },
          "Company": "Acme Widgets"
        },
        "Title": "Example Project 1"
      },
 {
        "__metadata": {
          "id": "72ba3c06-fae5-4a9e-afd4-5a21b66882d1",
          "uri": "https://xxxxxxxxxxxxxxxxxxxx/_api/Web/Lists(guid'd60b3a5b-e7e8-4d96-9b7e-6603ebf98903')/Items(19465)",
          "etag": "\"4\"",
          "type": "SP.Data.ArchivedProjectsListItem"
        },
        "ProjStatusLookup": {
          "__metadata": {
            "id": "8935849f-669b-4ef5-af3b-c04ed7a20786",
            "type": "SP.Data.ProjectStatusListItem"
          },
          "ProjStatusOptions": "Lost"
        },
        "CompanyLookup1": {
          "__deferred": {
            "uri": "https://tullydeath.sharepoint.com/lionshare/_api/Web/Lists(guid'd60b3a5b-e7e8-4d96-9b7e-6603ebf98903')/Items(19465)/CompanyLookup1"
          }
        },
        "Title": "Example Project 2"
      }

If i use this data in datatables, i get an error - 'DataTables warning (table id = 'example'): Requested unknown paramater 'CompanyLookup1.Company' from the data source for row 2'

As far as i'm concerned the data is valid, so if possible i'd like DataTables to ignore this error.

Is this possible?

Any other suggestions are also welcome, as i'm always keen to learn!

Many thanks all for your time,

Matthew.

Answers

  • allanallan Posts: 64,029Questions: 1Answers: 10,555 Site admin

    Hi Matthew,

    Can you run the debugger on your table so I can see how it is configured please?

    Thanks,
    Allan

This discussion has been closed.