The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

larstange
Kilo Sage

Hi



Im using the same feature and its working fine - here are some screenshots of my setup - maybe you can spot the difference



Widget Dependency record:


find_real_file.png


Related JS Include


find_real_file.png


UI Script



find_real_file.png



Calling the pagination in the widget


find_real_file.png


Result


find_real_file.png


Hi Lars,



Can you please share the Client Controller and Server scripts for this example?



Thanks


any css or html needed to add?


Hi Lars,



Could you please help on adding the paginate directive to "simple list" widget?