marcus-e
1/26/2018 - 5:50 PM

jQuery DataTables

Documentation and SM Amendments table code.

//Full code for Amendment table from **ContractAdminisration_step_2.html** as of 01/03/18:
var grid = self.amendmentsTbl.grid(
    {
        "lengthMenu": [[2, 5, 10, -1], [2, 5, 10, "All"]],

        "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull)
        {
            $(nRow).on('click', function(e)
            {   
                // alert(aData);
                var objOldAmendment = {};
                if(permissionLevel < 4) {
                    amendmentOrb.getOldAmendment(aData[0], function(rtn) {           
                        if(this.status != 'OK')
                        {
                            alert(this.status + '\n' + this.message);
                        }
                        else
                        {
                            objOldAmendment = this.oldamendment;
                            addamendmentpopuppanel.show();
                            addamendmentpopuppanel.update(objOldAmendment);
                        }
                    });
                }
                e.stopPropagation();
            });      
        },
        "aaSorting": [ 1, "desc" ],
        "columnDefs": [
        {
            "targets": [ 0 ],
            "visible": false,
            "searchable": false
        },
        {
            "targets": [ 1 ],
            "visible": true,
            "searchable": false
        }]
    },

jQuery DataTables

DataTables Documentation Website

  • columnDefs: (targets[0 / 1], visible [false/true], searchable)
    • target[0] pertains to first column. Visible: false.
    • target[1] pertains to second column. Visible: true.
  • fnRowCallback: function (nRow, aData, iDisplayIndex, iDisplayIndexFull)
    • Row data callback.
  • lengthMenu: [[2, 5, 10, -1], [2, 5, 10, "All"]]
    • The options for the # of results menu.
  • order / aaSorting: [ 1, "desc" ]
  • searchable: false - Turns off searchability for specified column.
  • targets: [ 0 / 1]
    • A specified column, starting from 0.
  • visible: false (and true)
    • visible: false - Hidden column.
    • visible: true - Shown column.