Adding addition tabindex option to open in New tab from list view portal

DB1
Tera Contributor

Hello All,

I have a cloned widge of Copy Data Instance from table "Instance with Table [sp_instance_table]" and is there a way that open in new tab could be added along with "show matching" etc

DB1_0-1669291800736.png

 

@Ankur Bawiskar @Mark Roethof @Community Alums @Mohith Devatte @Anil Lande @Jaspal Singh 

Open in New tab or ctrl option from Portal list view

Please advise 

Also, is there a way to change the backend/help text of the search from "Keyword Search" to something else?

 

I am looking for options to open any Incident record in a new window when selected from the data table cloned widget

 

Thanks,

DB

3 ACCEPTED SOLUTIONS

@DB1 Did the solution solve your problem? 

So my code  would have created a new button and when you click on the button it opens the record in new window

 

if not let me know if you need any alternative

 

If this solved the issue can you please mark the answer correct and close the thread so that it will be helpful for others in future?

View solution in original post

@DB1 but i can see the OOB code is this in my PDI .Did you change any code ?

just replace your widget id in the last line instead of test

 

(function(){
	/*  "use strict"; - linter issues */
	// populate the 'data' object
	var sp_page = $sp.getValue('sp_page');
	var pageGR = new GlideRecord('sp_page');
	pageGR.get(sp_page);
	data.page_id = pageGR.getValue("id");
	$sp.getValues(data);
	if (data.field_list) {
		data.fields_array = data.field_list.split(',');
	} else {
		data.field_list = $sp.getListColumns(data.table);
	}

	if (input) {
		data.p = input.p;
		data.o = input.o;
		data.d = input.d;
		data.q = input.q;
	}
	data.p = data.p || 1;
	data.o = data.o || $sp.getValue('order_by');
	data.d = data.d || $sp.getValue('order_direction');

	data.page_index = (data.p - 1);
	data.window_size = $sp.getValue('maximum_entries') || 10;
	data.window_start  = (data.page_index * data.window_size);
	data.window_end = (((data.page_index + 1) * data.window_size));
	data.filter = $sp.getValue("filter");

	var gr = new GlideRecordSecure(data.table);
	if (!gr.isValid()) {
		data.invalid_table = true;
		data.table_label = data.table;
		return;
	}
	data.table_label = gr.getLabel();

	options.table = data.table;
	options.fields = data.field_list;
	options.o=data.o;
	options.d= data.d;
	options.filter=data.filter;
	options.window_size=data.window_size;
	options.view = data.view;
	options.useInstanceTitle = true; // to make sure Data Table widget uses headerTitle always
	options.headerTitle = options.title;
	options.show_breadcrumbs=true;
	options.enable_filter=true;
	data.dataTableWidget = $sp.getWidget('test', options);
})();

 

 

View solution in original post

@DB1 Sure in the client controller i handled the redirection part in this below function at the top of your client controller script find it and replace it with below code 

c.openRecord=function(id)
{
window.open("/sp?id=ticket&table="+c.data.table+"&sys_id="+id ,"_blank");

}

 

Hope this helps 

Accept this solution if it helped you 

Thanks

View solution in original post

24 REPLIES 24

@Mohith Devatte I have a problem here. Need to show the breadcrumbs. It is not getting displayed.

@DB1 can you send me a screenshot of what is missing?

DB1_0-1669818753668.png

The breadcrumbs filter

@DB1 Do one thing open the outer widget which is the parent widget and then in the server script at the bottom under 47th line put this line and try 

options.enable_filter=true;

If this works hit the accept solution button 

Thanks

Thanks @Mohith Devatte but it didn't work

 

(function(){
	/*  "use strict"; - linter issues */
	// populate the 'data' object
	var sp_page = $sp.getValue('sp_page');
	var pageGR = new GlideRecord('sp_page');
	pageGR.get(sp_page);
	data.page_id = pageGR.id.getDisplayValue();
	$sp.getValues(data);
	if (data.field_list) {
		data.fields_array = data.field_list.split(',');	
	} else {
		data.field_list = $sp.getListColumns(data.table);
	}

	if (input) {
		data.p = input.p;
		data.o = input.o;
		data.d = input.d;
		data.q = input.q;
	}
	data.p = data.p || 1;
	data.o = data.o || $sp.getValue('order_by');
	data.d = data.d || $sp.getValue('order_direction');

	data.page_index = (data.p - 1);
	data.window_size = $sp.getValue('maximum_entries') || 10;
	data.window_start  = (data.page_index * data.window_size);
	data.window_end = (((data.page_index + 1) * data.window_size));
	data.filter = $sp.getValue("filter");

	var gr = new GlideRecordSecure(data.table);
	if (!gr.isValid()) {
		data.invalid_table = true;
		data.table_label = data.table;
		return;
	}
	data.table_label = gr.getLabel();
	
	var widgetParams = {
		table: data.table, 
		fields: data.field_list,
		o: data.o,
		d: data.d,
		filter: data.filter,
		window_size: data.window_size,
		view: 'sp',
		title: options.title,
		show_breadcrumbs: true,
		enable_filter:true, // I tried not working
		show_keywords: true
	};
	
	I tried this too not working
	/*var pageid = $sp.getParameter("id"); 

	var showBreadcrumbs = pageid == 'req' ? true : false; //If pageid is req then it is set to true, else false
	var activeFilter = "active=true";
	var widgetParams = {
		table: data.table, 
		fields: data.field_list,
		o: data.o,
		d: data.d,
		filter: activeFilter,
		window_size: data.window_size,
		view: 'sp',
		title: options.title,
		show_breadcrumbs: showBreadcrumbs,
		enable_filter:true,
		show_keywords: true
	};*/
	
	
	data.dataTableWidget = $sp.getWidget('copy_of_data_table_widget_2', options);
	//data.dataTableWidget = $sp.getWidget('widget-data-table', widgetParams);
	
})();