Simple List widget with pagination

Gaetano De Mitr
ServiceNow Employee
ServiceNow Employee

Hi guys,

How Can insert pagination on Simple List Widget ?

Thanks,

9 REPLIES 9

Liju John1
Mega Guru

Add the following Server-Script


data.window_size = data.window_size || $sp.getValue('maximum_entries') || 20;


      data.page_index = data.p - 1;


      data.show_new = data.show_new || options.show_new;



      data.window_start = data.page_index * data.window_size;


      data.window_end = (data.page_index + 1) * data.window_size;


      gr.chooseWindow(data.window_start, data.window_end);


      gr._query();




      data.row_count = gr.getRowCount();


      data.num_pages = Math.ceil(data.row_count / data.window_size);


      data.column_labels = {};


      data.fields_array = data.fields.split(',');




      var grForLabels = new GlideRecord(data.table);


vinayreddy9
Giga Contributor

Good Day.



1) Create a UI Script


      > API NAME : pagination.js


      > Script : Copy the content of this URL



2) Create Widget Dependency


      > Got to Service Portal > Dependencies


      > New


      > Name : pagination.js


      > Check Incude on page load


      > Angular Module Name : angularUtils.directives.dirPagination


      > save


      > In the JS inculdes related list


              > Click New


              > Display Name : pagination.js


              > Source : UI Script


              > UI Script : pagination.js




3) Import the XML file   attached: https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/development-best-...


4) Go to Service portal widgets > Simple list with pagination


5) Go to Dependenices related list


          > edit


          > Add pagination.js



While using this widget on any page, make sure "Maximum Entries" on widget options page is empty.



find_real_file.png



Thank you


It was awesome.


Thanks Vinay Reddy for this wonderful work.



Regards,


Rajshekhar Paul


Thank you for explaining very nicely .can you please put little light step no 3.

3) Import the XML file   attached: https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/development-best-...

 

What to do in this step.What we need to export and import here please help me on that.

Thanks in advance.