Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Data table double click function

TanayaGavande
Tera Expert

I have a Data table from Instance Definition cloned that on click of a row opens up the record in spModal. I want to open that modal on double click of the record, and only highlight the row when it is clicked once. I have added that modal on $scope.$on('data_table.click') function. Here is my code:

 

	$scope.$on('data_table.click', function(e, parms){
		spModal.open({
			title: "Edit Rock",
			widget: "rocks_form_edit_meeting", 
			widgetInput: {
				sys_id:parms.sys_id,
				table:parms.table
			},
			buttons: [
				{label:'', hide: true},
				{label:'', hide: true}
			],
		})
	});

 

I know I have to make change to the Data Table widget somewhere here in the Data Table widget:

$scope.go = function(table, item) {
		if ($window.getSelection().toString().length > 0)
			return;

		spNavStateManager.onRecordChange(table).then(function() {
		var parms = {};
		parms.table = table;
		parms.sys_id = item.sys_id;
		parms.record = item;
		$scope.ignoreLocationChange = true;
		for (var x in c.data.list) {
			c.data.list[x].selected = false;
		}
		item.selected = true;
		$scope.$emit(eventNames.click, parms);
		}, function() {
			// do nothing in case of closing the modal by clicking on x
		});	
	};

But how can I call double instead of single click? ng-dblclick doesn't work here, the entire widget disappears.

1 REPLY 1

Community Alums
Not applicable

ng-dblclick should be working I believe...Check this OOB widget <YOUR instance>/now/nav/ui/classic/params/target/sp_widget.do%3Fsys_id%3D09ca928f53231300a699ddeeff7b12d6%26sysparm_record_target%3Dsp_widget%26sysparm_record_row%3D4%26sysparm_record_rows%3D5%26sysparm_record_list%3DtemplateCONTAINSdblclick%255EORDERBYDESCsys_updated_on