prevent list from being populated when no filter is applied

I have a list page, and its data source is a spesefic object we have created.  above the list table there is a search element. What i want is when there is no filter applied the list table should be empty and, when any filter is applied then it should show only the matching resluts. How can i achieve this? What now happening is it is showing all of the existing records, but when i wanted to set up a business rule I could not find any option to access search element.

Like 0

Like

3 comments

And also, when the filter is cleaerd the list should again be empty as there is no filter applied

Zulaykho,

Clear the list isn't an easy task and needs a development team to be involved. Instead, you can prevent the list load by showing the Error message to the customer:

{
	request: "crt.SearchFilterColumnsGroupsRequest",
	handler: async (request, next) => {
		const searchValueLenIsZero = request?.value?.length == 0;
		const isEmptySearchValue = request?.value?.trim().length == 0;
		if (searchValueLenIsZero || isEmptySearchValue) {
			Terrasoft.showErrorMessage("There is no filter");
               } else {
                 await next?.handle(request);
               }
	}
}

Best regards,

Anhelina!

Anhelina,

Thank you a lot for your response! 

Show all comments