Page 1 of 2

Doing a new search after displaying the detail page

Posted: Mon Mar 31, 2014 10:12 am
by Kai Biefang

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


Doing a new search after displaying the detail page

Posted: Mon Mar 31, 2014 12:24 pm
by Kateryna Grynko

Hi Kai,

Are there any console errors?


Doing a new search after displaying the detail page

Posted: Mon Mar 31, 2014 12:39 pm
by Kai Biefang

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


Doing a new search after displaying the detail page

Posted: Tue Apr 01, 2014 2:12 am
by Alena Prykhodko

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.


Doing a new search after displaying the detail page

Posted: Tue Apr 01, 2014 7:22 am
by Kai Biefang

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?


Doing a new search after displaying the detail page

Posted: Tue Apr 01, 2014 11:13 am
by Kateryna Grynko

Hi Kai,

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


Doing a new search after displaying the detail page

Posted: Tue Apr 01, 2014 1:24 pm
by Kai Biefang

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.


Doing a new search after displaying the detail page

Posted: Tue Apr 01, 2014 11:29 pm
by Igor

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


Doing a new search after displaying the detail page

Posted: Wed Apr 02, 2014 9:17 am
by Kai Biefang

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?


Doing a new search after displaying the detail page

Posted: Wed Apr 02, 2014 10:10 pm
by Illya Stepanov

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.