How to add directive to widget serviceportal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 10:54 AM
Hi All,
I am trying my hands on serviceportal and new to angularjs.
I saw a video explaining how to include dependencies in widget. But it is not working.
So i am trying to pull data from table and display it and trying to do pagination using 3rd party "Pagination Directive"(angularUtils/src/directives/pagination at master · michaelbromley/angularUtils · GitHub ) . I have added the JS file under the dependency but not able to use it .
Can someone help on this. or let me know,do i need to do any other steps.
working code
<table class="rwd-table" style="background-color: white;">
<div class="searchResult" >
<tr ng-repeat="task in c.data.tasks">
<td>{{task.number}}</td>
<td>{{task.short_description}}</td>
<tr>
</div>
</table>
Added dependency
But when i tried the pagination it didnot .
<table class="rwd-table" style="background-color: white;">
<div class="searchResult" >
<tr dir-paginate="task in c.data.tasks" | itemsPerPage:5>
<td>{{task.number}}</td>
<td>{{task.short_description}}</td>
<tr>
</div>
</table>
Do i need to add anything in client script .
Client script:
function($scope) {
var c = this;
c.display = function() {
c.server.update().then(function(data) {
})
}
c.display();
}
Any help is appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2016 06:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2017 12:40 AM
Hi Lars,
Your post is really helpful. Thank you.
I am trying to use range.lower,upper and total values to generate a label " Showing 10-20 of 200 results".
Can you help with that ?
Regards,
Nitin Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2017 09:38 AM
Hi Lars,
I am trying to implement the same for one of the widget which is displaying closed incident in tabular form.I want to display 10 rows per page.I followed the same steps but it seems that it is not working in my case.
Can you Please guide if there is something that needs to be added to accomplish this.
Regards,
Parul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2017 01:05 AM
Hi
when you change page you can call a fuction - eg: "on-page-change="getPage(newPageNumber)" and you get the page number to your client controller.
From there it should be easy to generate the numbers you need to display for "Showing 10-20 of 200 results".
You know your page size and you just need to know the number of records you retrieve from the server as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2017 02:26 AM
Can't I create a new dir-pagination template for this ? Because range.lower, upper and total are already available there. Do you know how I can access these range values in widget HTML ?