function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ankit DableAnkit Dable 

Parsing error: Unexpected token in below code of Lightining controller

({
	doInit : function(component, event, helper) {
		component.set(v.columns[
               {label: 'Department ID', fieldName: 'DepartmentID', type: 'Auto Number'},
               {label: 'Department Name', fieldName: 'Name', type: 'text'},
               {label: 'Department Manager', fieldName: 'DepartmentManager', type: 'text'},
        	   {label: 'Employee Count', fieldName: 'NoofEmployee', type: 'number'}
        ]);
		var action= component.get("c.getRecord");
        action.setCallback(this, funtion(response){
                          var state=response.getState();
        if(state==="SUCCESS"){
            component.set("v.dept",response.getReturnValue());
        }
        else{
            console.log("Failed with state: " + state);
        }
        });
		$A.enqueueAction(action);    
}
})
I am getting  Parsing error: Unexpected token {  at line 10.
Can someone suggest me what is requier in this?
Thank you!!
 
Raj VakatiRaj Vakati
Try this
 
({
    doInit : function(component, event, helper) {
        component.set('v.columns', [
            {label: 'Department ID', fieldName: 'DepartmentID', type: 'Auto Number'},
            {label: 'Department Name', fieldName: 'Name', type: 'text'},
            {label: 'Department Manager', fieldName: 'DepartmentManager', type: 'text'},
            {label: 'Employee Count', fieldName: 'NoofEmployee', type: 'number'}
        ]);
        action.setCallback(this, function(response) {
            var state = response.getState();
            var state=response.getState();
            if(state==="SUCCESS"){
                component.set("v.dept",response.getReturnValue());
            }
            else{
                console.log("Failed with state: " + state);
            }
        });
        
        $A.enqueueAction(action);    
    },
})

 
Raj VakatiRaj Vakati
Does it worked?