
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 12:32 PM
Hi all,
I've embedded the Data table with Filter widget into a custom widget and now trying to see if it is possible to perform a list edit action on the table. I've searched through the community and haven't found anything yet.
I'm doubtful that the Data table with Filter widget will allow me to perform inline edits based on what the code was showing, but I wanted to ask if anyone has found a workaround for this limitation. Or do I need to use a different widget to be able to do inline list editing?
Thanks,
~britt
Solved! Go to Solution.
- 9,483 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 12:56 PM
I put it inside the td. but there are a few other issues that I had to overcome in that the sp-editable-field directive requires a data model that you would normally get from the $sp.getForm call. But I didn't want to call that for every record in the list, so created a custom script include to give me the data I needed for each field. If you think of a better way, let me know, but here is the update set for what I did. hope that helps you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 02:02 PM
Yes that is correct. I needed the field data model to pass into the sp-editable-field directive, but I couldn't find an OOB way to get this without calling $sp.getForm for every record in the list. That, unfortunately, was not an option because it would be far too expensive a call (performance) in my view.
Check out this community post I did requesting an API to get a trimmed down version of this data model for a group of fields on a table. No responses yet.
https://community.servicenow.com/community?id=community_question&sys_id=ba204761db98dbc01dcaf3231f9619bd
For now, I haven't had a need to revisit this yet, as I am not yet using this widget anywhere, so if you find an API in your research, let me know!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 10:43 AM
When using the widgets provided have you ever tried embedding them through the sp-widget? I tried to do that in Istanbul (after transferring the directive to another data table widget) and it kept giving me this error saying "TypeError: Cannot set property 'table' of undefined". I tried a few different ways to set the table value through either the client side or server side scripts, but have not been able to find a solution.
I was able to test the widgets on a vendor instance (on Kingston and not embedded) and they worked great. Just wanted to see if you had tried this approach with the editable list widget. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 11:58 AM
I haven't tried that yet, but may need to do a test to make sure that works. I haven't tested that yet, as I haven't had much time to finish that out. I will try that out tonight or this weekend and see if I can reproduce it. If you identify the issue before me, let me know so I can fix it on my end too.
Are you passing in the table to the config object in the getWidget call? can you send me the server side code you are using to get the instance of the widget so I can test with that too?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 12:18 PM
I normally put the following into the server side code.
var options = {
table:"u_time_forecast",
max:"5",
o:"sys_created_on",
filter:"u_project=" + pjSysID,
show_breadcrumbs:"true"
};
data.opts = [];
data.opts.push($sp.getWidget("copy-data-table", options));
Then here is the html:
<div ng-show="c.data.opts != ''" class="col-md-12" ng-repeat="List in c.data.opts">
<sp-widget widget="List"></sp-widget>
</div>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 02:23 PM
interesting, so you are embedding multiple data tables in the same page? anyway, that all looks fine to me otherwise. I will try that later and see what the issue is.