How to add directive to widget serviceportal

sam1212
Mega Expert

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.

28 REPLIES 28

sam1212
Mega Expert

Hi Parul,



Can you post your screen shot.


amalina
Mega Contributor

Hi,


I have a question, can we use sorting with this pagination?



Thanks,


-Lin-


jyoti29208
Giga Expert

Hi Sam,



In the service portal itself there is an option in widget to add dependencies. you can directly add dependencies from there.



Please provide your feedback appropriately (Like, Helpful, Endorse AND/OR Correct) to help community.


Thank you!



Regards,


Jyoti


kanguleyogesh
Kilo Explorer

Hi lars

I have to use pagination on kb kategory page, and added dependency for that widget as mentioned above but not getting any idea what to write in client controller.

could you please help on the same.

 

Thanks and Regards

Yogesh

Hey Yogesh, I am looking for the same information, where you able to figure out what goes on the client side?