Kai Biefang
Posts: 0
Joined: Mon Mar 31, 2014 10:12 am

Doing a new search after displaying the detail page

Hello,

The situation is the following:
We are building a tablet app to display customer data.

When you first start the app, you see a search field where you can enter a name and search for customers. The "Search" Service we built, displays a list of the matching customers.

Image

When you now click on a customer, the detail page for this specific customer is displayed.

Image

Image

Now, we want to do a search in the search bar again, but in fact, we cant. The click on the search button has no effect.

This may has the reason, that we are still on the "Detail Page" and the Search Service we built is located in the home page of the app and not on the detail page which is displayed currently (as you can see in the header).

How can we solve our problem?

One way to solve this problem would be to get all the customers on the load of the home page and then filter the displayed list with its built-in filter. But unfortunately our database has too many entries and this would slow down the performance enormously.

Thanks in advance, Kai

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Doing a new search after displaying the detail page

Hi Kai,

Are there any console errors?

Kai Biefang
Posts: 0
Joined: Mon Mar 31, 2014 10:12 am

Doing a new search after displaying the detail page

Hello Katya,

The console is returning the following when i try to press Search after switching to the detail page:

codeTypeError Cannot call method 'trim' of undefined/code

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Doing a new search after displaying the detail page

Hello Kai.

If you want to implement dataSource (based on the same service) on diffrent pages you need to invoke it on each pages.

So:

1 On the deatils page create datasource the same as on the list page.

2 Edit mapping on this datasource like in the listpage.

3 Call this datasource like in the list page.

Kai Biefang
Posts: 0
Joined: Mon Mar 31, 2014 10:12 am

Doing a new search after displaying the detail page

Hello Alena,

The problem is I cannot invoke the data source on the detail page because the button is located in the home page. So I cant select an event for the source to fire on the detail page.

On the other hand I tried to create a Service on the detail page with the same name, but the designer tells me that the name is already taken.

Do I understand something wrong?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Doing a new search after displaying the detail page

Hi Kai,

On what line the error is? Is it in your code or in automatically generated code?

Kai Biefang
Posts: 0
Joined: Mon Mar 31, 2014 10:12 am

Doing a new search after displaying the detail page

Hello Katya,

The error points to this line of code:

Image

I think the problem is following: The list and the detail page are two different pages although they are displayed at the same time. The Search Service is located in the list page, so I am not able to access the Search Service while I am in the detail page.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Doing a new search after displaying the detail page

Hello,

You can't invoke service on the page from other page because you are using two different pages. But you can pass some localStorage variables(LSV) between this pages. And run the service depends on this LSV.

So when you are searching in the list page you should save "searchFiler" value in LSV.
When you load "Details page" you can get value from LSV to the search filter and invoke query service on this page.
Also you should use different service names for datasources. For example "searchListOnSearchPage" and "searchListOnDatailsPage".
Image

Kai Biefang
Posts: 0
Joined: Mon Mar 31, 2014 10:12 am

Doing a new search after displaying the detail page

Hello Igor,

I now fill a local storage variable named "searchFilter" when i press the search button on the list page.

Image

Also, I created a new Search Datasource on the detail page as you told me to do. But the problem is: I cant map the response to the list on the list page, because the list is on the list page and not on the detail page, where the new "SearchOnDetail" Datasource is located.

Image

Am I understanding something wrong in your approach?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Doing a new search after displaying the detail page

Hi Kai,

You need to add on the "detail page" all that you need.

Thus your list must be in two places (on the list page and on the detail page).

If you have some specific view for this elements or other components common for these two pages you can save them as custom components.

Please read about it here:
:: http://docs.appery.io/tutorials/build...

and here:
:: http://blog.appery.io/2011/06/creatin...

Regards.

Return to “Issues”