I have a list control onto which I apply a dynamic filter based upon the profile of the user accessing the form. I would like to provide a count of items in the list based upon this filter. Currently using:
fd.control('MyList').widget.dataItems().length;
This returns the total number of items in the list. Is it possible to count after filtering?
Thanks,
Chad
Dear @cwalter2,
It's best to use pnpjs with custom filter to retrieve these items and get their number - List Items - PnP/PnPjs
Here you can find an example of how it can be used to get all items - Unable to get List Items with CAML Query - #2 by mnikitina
1 Like
@Nikita_Kurguzov hi has any updates been applied enabling getting the count? My scenario is I have a list (view) widget on my form which I am filtering on change of a lookup field, and I need to get count.
dt.filter = "<Eq><FieldRef Name='Period'/><Value Type='Lookup'>" + value.LookupValue + "</Value></Eq>";
dt.refresh();
Dear @SamirPateluk,
If you're working with limited number of items, the following might work:
fd.control('ListOrLibrary1').widget.dataItems().length;
But for bigger sets, a custom request will likely be necessary.
2 Likes