Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Data Table Widget

sgmartin
Kilo Guru

Using the Data Table widget in the Service Portal that comes with Helsinki.   Cloned it so that I could make it work for me.   I added the table name (change_request) and added the fields I wanted to see.   That however doesn't seem to be what that field means when I edit the widget.   The widget defaults to 4 fields (Number,Category,Short Description and Approval).   I did not select all of these and actually added a couple others I wanted to see but they don't show.   I love the look of the table that it presents, but it's just not acting the way I expected.   What am I missing about customizing/configuring a widget?

48 REPLIES 48

Chuck Tomasi
Tera Patron

Hi Stanley,



Check which view is being used and configure the corresponding list view. I haven't looked too closely at the widget itself, but there are comments at the top of the client script code that indicates it is a configurable parameter.


In the Client Script at the top are the options:



function ($scope, $location, spUtil, amb, $http) {


var c = this;


/*



  • options:



  • hide_footer (bool) = true to remove the data table footer contents



  • hide_header (bool) = true to remove the data table header contents



  • show_new (bool) = true to show the "New" record button



  • show_keywords (bool) = true to show the keyword search field



  • table (string) = the table name to query



  • filter (string) = the encoded query



  • o (string) = the order by column



  • d (string) = The order by direction: asc or desc



  • p (int) = the page to jump to



  • fields (string) = comma seperated list of fields that become the list columns



  • view (string) = the default view to load for columns, overrides fields


*/


fields = "number,u_business_unit,location,short_description"; <- I added this as the list of fields I want to see




The Server Script also has options that I have tried to modify. But neither one changes anything. The default fields that show are





Stanley Martin


ServiceNow Developer


Epiq


Corporate Services


Phone: 913-621-9824


Cell: 913-216-1031


No matter what I try, all I get are the 4 default fields that come with the Data Table widget.   I have modified the Client Script by adding a line as follows:


fields = 'number,u_business_unit,location,short_description';



and in the Server Script:


data.fields = 'number,u_business_unit,location,short_description';



Individually, neither worked.   It totally ignores anything I add.   Even adding the fields to the widget edit doesn't change anything.


Hi Stanley,



Sorry. I've run out of ideas. My Service Portal knowledge and AngularJS is a bit limited at this point. I'll see if I can pull in someone with a bit more experience.