Data-table widget not showing results

Toube1
Tera Expert

Hi,

I'm trying to show data using the data-table widget on my PDI.

I've cloned the OOB data table widget.

The table is a custom table and I'm calling it from the portal widget with options set etc.

The problem is that the widget is visible on the page and the data is there, I have logged the results to the console log so there is 20 rows of data (with selected fields) but the the widget just loads and only shows the menu for exporting data and no actual data rows are shown.

Can't get my head around why the data is not being printed out.

Any ideas?

I'm using admin to test this so it should be a access issue.

find_real_file.png

Br,

Toube

1 ACCEPTED SOLUTION

in HTML

  <div class="row borderLeftRight">
    <div class="col-xs-12 col-md-12" ng-hide="logIsEmpty" style="padding-top: 15px; color: #000; border-top: 1px solid #ddd;">
      <sp-widget widget="data.dataTableWidget"></sp-widget>
    </div>
  </div>

In Server

	var widgetOptions = {
		"table": "u_mountainbikestats",
		"view": "default",
		"p": 1,
		"o": "u_ride_date",
		"d": "desc",
		"filter": "u_bike.u_ownerDYNAMIC"+data.userid,
		"fields": "u_bike,u_ride_date,u_location,u_time,u_km",
		"table_label": "MountainBike Ride Stats",
		"table_plural": "MountainBike Ride Stats",
		"show_breadcrumbs": true,
		"enable_filter": true,
		"filterACLs": true
	};
	data.dataTableWidget = $sp.getWidget('mtb-data-tables', widgetOptions);

View solution in original post

6 REPLIES 6

Weird
Mega Sage

Where are you logging the information at when you can see that there are records?

For example the HTML part is referencing data.list at some point, so if no values are printed, then it would be a good idea to check whether data.list on server side actually has anything or if any of the conditions are not satisfied.

data.list = [];
	while (gr._next()) {

And then just browse through the HTML part, make sure there's no typos which would break it. For example if you've edited anything in any of the if conditions or if you've accidentally removed a < or > at some point.

Hi Joni,

 

thanks for replying.

I'm logging it in the controller.. but not in the data widget controller but in the widget were I call the data-table widget:

Like so:

spUtil.get('data-tables', options).then(function(response) {
	    $scope.widget_show = response;
	    console.log(response);
});
	

And the controller shows the list as an array with 20 items and the selected fields in them.

 

If the controller shows the list with data then I assume the server side is successully returning the data to the controller?

 

Edit:

 

Logging the data-table widget server side:

console.log('data.list :'+data.list);

Will produce 20 objects in the console so the data is there but not printed out

Br,

Toube

Toube1
Tera Expert

Got it working using a server side call.

karthik ande
ServiceNow Employee
ServiceNow Employee

@Toube , can you please explain how did you get the widget working.