- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎06-05-2017 02:37 AM
Hi everyone,
Here's an example of a modification of two baseline widgets: "Data Table from Instance Definition" and "Data Table". Data Table from Instance Definition is an extension for Data table, with that I mean that it utilizes the Data Table widget as a base and then adds a few more features.
The Data Table from Instance Definition widget without modifications looks like this:
We will add a keyword search and an option to select a view instead of specifying fields. It will look like this:
Here's how it's done:
1. Check options in the Data Table widget Client Script. There are 2 options that we are interested in, that are not used in the Data Table from Instance Definition widget: show_keywords and view.
2. Clone the Data Table from Instance Definition widget. I called it "List with Keyword Search". Name/Id is not important.
3. In the Server Script, scroll down to the bottom and look at the "widgetParams" object:
var widgetParams = {
table: data.table,
fields: data.field_list,
o: data.o,
d: data.d,
filter: data.filter,
window_size: data.window_size,
view: options.view,
title: options.title,
show_breadcrumbs: true,
show_keywords: true
};
data.dataTableWidget = $sp.getWidget('widget-data-table-with-search', widgetParams);
- Notice that we are changing/adding three things: view, show_keywords and data.dataTableWidget.
- view: options.view removes the hard-coding of the view (it was 'sp' before) and makes it get the view from options instead.
- show_breadcrumbs: true adds the option as we saw it in the Data Table widget.
- data.dataTableWidget = $sp.getWidget('widget-data-table-with-search', widgetParams); here we change the referenced widget id to match our future cloned widget. We will create it in the next step.
4. Clone the Data Table widget. I called it Data Table with Search. It must have the same ID as we set above: widget-data-table-with-search.
5. In the Server Script, at the top, add some handling of the view option:
(function() {
if (!input) // asynch load list
return;
data.title = options.title || input.title;
data.view = options.view || input.view;
- data.view = options.view || input.view; gets the value from the option and makes it usable in the widget. Notice how it is handled in the same way as the title, which is also an option.
6. Go to the Designer and add the first widget we created, List with Keyword Search, to a page. hover over the new Widget Instance and press the pen (edit). Enter for example "incident" in the Table field.
7. Now we need to add the View option to the widget. The widget that we cloned had an options table already so for simplicity we will just add an option through JSON.
- In the Designer, Add this into the "Additional options, JSON format" field:
{
"view": {
"value": "ess"
}
}
8. Try it out!
Good luck implementing in your own instances.
Best Regards,
Miriam
- 11,380 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello Miriam,
This seems to work until you add a filter. With a specific filter, the search functionality never returns any value.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Interesting! Will try to replicate the issue.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
No worries, was really helpful. I had implemented angular filters with the same look and feel which seems to work much better. Maybe it was the SN version which am currently on (Helsinki). Thanks!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Miriam,
Do you know if there is any easy/OOTB way to enable searchable fields in each column's header (like there was in CMS and in the standard UI)
Thanks,
- James
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I wish I had found an easy way for that... But I haven't yet.. Sorry! 😕
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
i am trying to customize Data Table from Instance Definition and Form and hoping i can get some help
How do I update custom fields on incident table from portal page?
I have a page with 3 widgets:
clone of Data Table from Instance Definition (set to the incident table)
clone of widget-form
custom widget to get 3rd party data to be set on the incident record
In server script of widget-form widget I have the values that my custom widget got (i do a gs.info of input.field_name and can see the value)
How do i change the server script of my Form widget to get the data into the incident record to be saved when i click the save button?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
hi,
How can i increase the size/lenghth of the search field/option?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This works great however I have observed it does not work for PDF generation so please keep that in consideration, as well as you must consider when the view you set changes with available fields if that should be the correct view to set or not.