Data Table Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2016 10:29 AM
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?
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2016 02:43 PM
I got it. Very strange the way it acts though
If I set this at the top of the script:
data.fields = 'number,u_business_unit.u_name,location,short_description';
it doesn't work.
There is this block of code:
if (!data.fields){
if (data.view)
data.fields = $sp.getListColumns(data.table, data.view);
else if (!data.fields)
data.fields = $sp.getListColumns(data.table);
}
One would think this would be totally ignored since I am setting data.fields at the top. But that's not the case. If I moved that statement after this block of code, it works as I would expect. I just now need to get the mapping fixed so the headers come out right. Not sure where $sp.getListColumns is define either. Might help if I could find that.
Thanks for the suggestion. It got me looking in the right spot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2016 02:56 PM
Hi Stanley,
Great to hear that you already figured out a workaround!
I stumbled upon the same thing after Chuck asked me to have a look at it
data.fields = $sp.getListColumns(data.table) always returns that 4 field array, even if you adjust the Portal List Layout - I will verify with the SP Dev team if that's the intended behaviour, looks like a bug to me.
Another way, that doesn't require changing the code, is to utilize the "Data Table from Instance Definition" Widget - that worked perfectly fine for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2016 06:46 AM
Thanks for the tip Frank. That other widget does work just fine. I see the only difference is the fact that the "Data Table from Instance Definition" widget also displays the filter.
One other thing I have seen actually on both widgets. It appears they are ignoring the Title in the configuration.
In the "Data Table" Widget, these 2 lines are setting or getting the data table label:
data.table_label = gr.getLabel();
data.table_plural = gr.getPlural();
I set the label after these statements and it seems to work now. No big deal, I was already modifying the code anyway.
Stanley Martin
ServiceNow Developer
Epiq
Corporate Services
Phone: 913-621-9824
Cell: 913-216-1031
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2016 08:36 AM
Seems they all have their own little quirks. I've noticed that the "Data Table from Instance Definition" Widget ignores the Bootstrap Color. I can work around that, but as long as you're talking with the developers, you might mention this one too.
Stanley Martin
ServiceNow Developer
Epiq
Corporate Services
Phone: 913-621-9824
Cell: 913-216-1031
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2016 02:19 AM
Hi Stanley- Even the pagination is not working in Data Table widget. It is displaying most of the records and but at the bottom ff the page it is showing row 1-5?
Did you able to fix column name issue as mentioned in your question?
Also, It would be great if you explain me what this Async code/parse query and create query are doing is doing in Client script?