Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Assignment to constant variable #27

Open
waltersdmh opened this issue Oct 22, 2019 · 1 comment
Open

Uncaught TypeError: Assignment to constant variable #27

waltersdmh opened this issue Oct 22, 2019 · 1 comment

Comments

@waltersdmh
Copy link

I get the following error when I try to assign the rowsGroup setting to column 6.

Uncaught TypeError: Assignment to constant variable

Error traceback to
// Automatic initialisation listener
dataTables.rowsGroup.js:201

$(document).on( 'init.dt', function ( e, settings ) {
	if ( e.namespace !== 'dt' ) {
		return;
	}

	var api = new $.fn.dataTable.Api( settings );

	if ( settings.oInit.rowsGroup ||
		 $.fn.dataTable.defaults.rowsGroup )
	{
		options = settings.oInit.rowsGroup?
			settings.oInit.rowsGroup:
			$.fn.dataTable.defaults.rowsGroup;
		new RowsGroup( api, options );
	}
} );

Global tableOptions

var tableOptions = {
            "columns": [
                {
                    title: "check",
                 
                    "name": "check",
                    orderable: false,
                    className: 'select-checkbox dt-center',
                    targets: [0],
                },
                {
                    title: "status",
                  
                    "name": "status",
                    targets: [1],
                    "visible": true,
                    "className": "dt-center"
                },
                {
                    title: "txtSchoolID",
               
                    "name": "txtSchoolID",
                    "targets": [2],
                    "visible": false,

                },
                {
                    title: "TblPupilManagementAddressesID",
                
                    "name": "TblPupilManagementAddressesID",
                    "targets": [3],
                    "visible": false
                },
                {
                    title: "personID",
                  
                    "name": "personID",
                    "targets": [4],
                    "visible": false
                },
                {
                    title: "pupil_fullname",
                
                    "name": "pupil_fullname",
                    "targets": [5],
                    "visible": true,
                },
                {
                    title: "txtForename" ,
                 
                    "name": "txtForename",
                    "targets": [6],
                    "visible": false
                },
                {
                    title: "txtPreName",
            
                    "name": "txtPreName",
                    "targets": [7],
                    "visible": false
                },
                {
                    title: "txtSurname",
               
                    "name": "txtSurname",
                    "targets": [8],
                    "visible": false
                },
                {
                    title: "parent_full_name",
      
                    "name": "parent_full_name",
                    "targets": [9],
                    "visible": true
                },
                {
                    title: "parent_email",
                    
                    "name": "parent_email",
                    "targets": [10],
                    "visible": true
                },
                {
                    title: "parent_relationship" ,
                   
                    "name": "parent_relationship",
                    "targets": [11],
                    "visible": false
                },
                {
                    title: "initial_mailing_sent",
             
                    "name": "initial_mailing_sent",
                    "targets": [12],
                    "visible": true,
                    "className": "dt-center"
                },
                {
                    title: "reminder_sent",
             
                    "name": "reminder_sent",
                    "targets": [13],
                    "visible": true,
                    "className": "dt-center"
                },
                {
                    title: "letter_salutation" ,
                   
                    "name": "letter_salutation",
                    "targets": [14],
                    "visible": false
                },
                {
                    title: "student_on_trip_uuid",
                   
                    "name": "student_on_trip_uuid",
                    "targets": [15],
                    "visible": false
                },
                {//idea for a preview link to open model iframe?
                    title: "preview",
                   
                    "name": "preview",
                    "targets": [16],
                    "visible": false,
                    "render": function (TblPupilManagementAddressesID, type, full, meta) {
                        return '<a href="" data-toggle="modal" data-target="#exampleModal">Preview</a>';
                    }
                },
                {
                    title: "response",
                   
                    "name": "response",
                    "targets": [17],
                    "visible": true,
                    "className": "dt-center"
                },
                {
                    title: "payment",
                    
                    "name": "payment",
                    "targets": [18],
                    "visible": true,
                    "className": "dt-center"
                },
            ],


            select: {
                style: 'multi',
                selector: 'td:first-child'
            },
            order: [[1, 'asc']],
            paging: false,
            searching: false,
           rowsGroup:[5]
           
        };

My init:

    var table_data = getTableData();
    tableOptions.data = table_data;
    var mailing_table = $('#mailing_table').DataTable(tableOptions);   
@waltersdmh
Copy link
Author

I've solved this by replacing the line in source code.

options = settings.oInit.rowsGroup?
to
var options = settings.oInit.rowsGroup?

options must have been used as a global var in one of my other src libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant