Power Apps Data Table Empty

145 views Asked by At

I have data table control and it will retrieve the data from my collection. Till now it's fine. Now I want to make the data table empty without using any other controls like a button, or trash icon. Is there any possibility of using the direct function to make the data table empty?enter image description here

2

There are 2 answers

0
Sam Nseir On BEST ANSWER

As an example with using a variable. Have a button with:

OnSelect = UpdateContext({ showTable: !showTable })

Then update the data table with:

Items = If (showTable, colEmployeeRegistration )
0
Sumit Singh On

You can try using the following way:

  1. Add the following code on your screen OnVisible property:
Set(ShowData, true);
  1. Add a button and add the following code in its OnSelect property:
Set(ShowData, !ShowData);
  1. Replace your Items code with the following code:
Filter(colEmployeeRegistration, Or(ShowData, Name = "    "))

By this first, your whole data will be visible as your flag (ShowData) is set to true. Once you click the button flag will be set to false and the second condition will be checked i.e. Name = " ", which I assume will never happen. Hence, the table will be blank.

You can also replace this condition Name = " ", with any other condition, which always results in a false value.