JSON returned null after including a unique field

JSON returned null after including a unique field

e8416o8e8416o8 Posts: 25Questions: 9Answers: 1

After adding an unique key field to JSON data to make Edit/Delete buttons work, I am getting NULL from JSON response.
I can see the JSON populated as follows. This is a portion of JSON.

JSON=[[101884,"KRTEST","KRTest","CR372119CYCLE",null,"DD",null,"10/24/2014","12/31/2078"], [101885,"KRTEST","KRTest","CR366532",null,"D ",null,"10/24/2014","12/31/2078"]]

Here is the js code:
PyrContractUID is the unique field that differentiates each record.

var editor; // use a global for the submit and return data rendering in the examples
 
$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        serverSide: true,
        ajax: '/myPayers/DataTableServlet',
        table: '#payers',
        fields: [ {
                label: "PyrContractUID:",
                name:  "pyrContractUID"
            }, {
                label: "Payer ID:",
                name:  "payerID"
            }, {
                label: "Payer Name:",
                name:  "payerName"
            }, {
                label: "Contract ID:",
                name:  "contractID"
            }, {
                label: "Ins Co:",
                name:  "insCo",
            }, {
                label: "Ins Type:",
                name: "insType",
            }, {
                label: "Ins Group ID:",
                name: "groupID",
            }, {
                label: "Effective:",
                name: "eff",
                type: "date"
            }, {
                label: "Termination:",
                name: "term",
                type: "date"
            }
        ]
    } );
 
    $('#payers').DataTable( {
        
        dom: 'Bfrtip',
        type: 'POST',
        bServerSide: true,
        sAjaxSource: '/myPayers/DataTableServlet',
        idSrc:  'pyrContractUID',
        bProcessing: true,
        spagingType: 'full_numbers',
        bJQueryUI: true,

        columns: [
            { "sInt": "id",
                    "bSearchable": false,
                    "bSortable": false,
                    "bVisible": false  },
            { "sName": "payerID" },
            { "sName": "payerName" },
            { "sName": "contractID" },
            { "sName": "insCo" },
            { "sName": "insType" },
            { "sName": "groupID" },
            { "sName": "eff" },
            { "sName": "term" }

        ],
        columnDefs: [ 
                     { "targets": "contractID",  
                       "defaultContent": "",
                     },
                     { "targets": "insCo",  
                         "defaultContent": "",
                       },
                     { "targets": "insType", 
                         "defaultContent": "",
                     },
                     { "targets": "groupID", 
                         "defaultContent": "",
                     }
        ],                     

        select: true,
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ]
    } );
} );

Replies

  • e8416o8e8416o8 Posts: 25Questions: 9Answers: 1

    This is resolved.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Great to hear - thanks for posting back. Was your other question about the edit button not working also resolved?

    Allan

  • e8416o8e8416o8 Posts: 25Questions: 9Answers: 1

    No, not yet.

This discussion has been closed.