Display pre-filtered search data on data-grid

0
Hi Team, I have a datagrid which has a microflow as it’s data source. The data it fetches has two kinds of records(open/closed records- based on a boolean field in each record). Initially when the page with the datagrid is loaded we can see both kind of records and have to filter using Search bar to view only ‘open records’. The requirement, however, is to view only ‘open records’ by default (when the page is loaded) and view all records when filter from Search bar is removed.  Is there a way to achieve this? Thanks
asked
2 answers
2

Which search bar are you using? By default, the datagrid does not have a search bar if datasource is microflow.

answered
1

Hi Priyanka,

If you are using data source as microflow on data grid then I assume that you have Set Up Server-Side Paging and Sorting for a Microflow Data Source and a non-persistable entity (e.g. Home_DataGrid) is created for you automatically and there is a data source microflow (e.g. DS_Home_DataGrid_Create). Can you try going to this microflow and set the default value of the search Boolean attribute as required and see if that works?

Update: 

I tried it myself using the steps below and this works. 

  1. Added a data grid and selected data source as microflow (created a microflow called (DS_GetAccounts, retrieve action added to retrieve all accounts from database, this microflow will have a Home_DataGrid parameter)
  2. Create a data source microflow to retrieve all accounts
  3. Selected ‘Yes’ for question “Do you want to automatically fill in the contents of the data grid”
  4. Selected ‘Yes’ for questions “Do you want to generate controls for microflow source parameters of the data grid? This will enable server-side paging, sorting and searching for the grid”
  5. This automatically created everything for me including ‘Home_DataGrid’ entity. Went to domain model > ‘Home_DataGrid’ entity to add new Boolean attribute called ‘Active’ and set the default value to ‘true
  6. Went to my data source microflow DS_GetAccounts and updated the retrieve action XPath to add ‘[Active=$Paging/Active]
  7. Run the project and I can only see active accounts.

If you follow same steps as above and add your required search attribute to Home_DataGrid entity, set the default value and update the retrieve XPath accordingly then this should give you the desired results.

 

Hope this helps!

answered