columns data vs. sInt & sName

columns data vs. sInt & sName

e8416o8e8416o8 Posts: 25Questions: 9Answers: 1
edited June 2016 in DataTables 1.10

Following is an excerpt:
If I use data, then data are not shown in the table. But if I changed data to sInt & sName, data are shown in the table.
Why is that?

    $('#example').DataTable( {
        
        dom: 'Bfrtip',
    type: 'POST',
        bServerSide: true,
        sAjaxSource: "folder/myServlet",
        bProcessing: true,
        spagingType: 'full_numbers',
        bJQueryUI: true,
        select: 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" }

        ],



/* another version with data
           { data: "id",
                    "bSearchable": false,
                    "bSortable": false,
                    "bVisible": false },
            { data: "payerID" },
            { data: "payerName" },
            { data: "contractID" },
            { data: "insCo" },
            { data: "insType" },
            { data: "groupID" },
            { data: "eff" },
            { data: "term" }
*/            

Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,824Questions: 1Answers: 10,131 Site admin
    Answer ✓

    columns.data tells DataTables where to get the data for each cell. columns.name assigns a name to the column and can be used for selectors.

    If it isn't working for you, please link to a test case showing the issue.

    Allan

  • e8416o8e8416o8 Posts: 25Questions: 9Answers: 1

    I changed to as follows. Now data are shown.
    Thanks for your response, Allan.

            columns: [
                      
                { data: 0, "sortable": false, "visible": false},  // PyrContractUID
                { data: 1},   // payerID
                { data: 2, editField: 2},   // payerName
                { data: 3, editField: 3},   // rateSchedule
                { data: 4},   // insCo
                { data: 5},   // insType
                { data: 6},   //  groupID
                { data: 7},   //  eff
                { data: 8}    //  term
            ],
    
This discussion has been closed.