Limit records in Data Table from Instance widget

charliesdev
Giga Expert

I need to limit the number of records returned to  my "Data Table from Instance" widget (not the page size), but there doesn't seem to be an option for this.  I have hundreds of records in the widget and want to limit it to 100.

I cloned it and the widget it loads (Data Table).  Inside the server script for the cloned data table widget, I added this:

gr.setLimit(100);

But now instead of returning hundreds of records, it returns 20!

Please help.

1 ACCEPTED SOLUTION

charliesdev
Giga Expert

I was trying to prevent the possibility of a widget returning 10's of thousands of records.  It looks like that won't be an actual problem, since the widget runs a "get row count" query and fetches only the "page size" number of records to initially display.  So far it's working with large numbers of results.  I was just confused about the lack of support for the query modifier "setLimit()".  I guess we can live without it though.

Thanks for your input.

View solution in original post

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

you can update default number of rows for list.

Please check below for updating row count.

https://docs.servicenow.com/bundle/helsinki-platform-user-interface/page/use/using-lists/task/t_CustmNumListRowsPerPg.html

 

Regards,

Sachin

charliesdev
Giga Expert

Hi Sachin, I'm actually working with a portal widget - not in the platform.  Also I'm trying to limit the total number of records returned by the query, not the number of records per page.

In data table widget below line is limiting number of records to 20

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

charliesdev
Giga Expert

I was trying to prevent the possibility of a widget returning 10's of thousands of records.  It looks like that won't be an actual problem, since the widget runs a "get row count" query and fetches only the "page size" number of records to initially display.  So far it's working with large numbers of results.  I was just confused about the lack of support for the query modifier "setLimit()".  I guess we can live without it though.

Thanks for your input.