This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Sep 23, 2013, 1:00 PM
13 Posts

Search working differently for Views and Data Views

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 9.0
  • Role: Developer
  • Tags: search,view
  • Replies: 3

I created an Xpage with a view and an edit box. In the edit box I have javascript in the onKeyUp event that builds a search string and puts it in the viewScope variable and I fire a partial update on the view.

My js code looks like this:

 

var search = getComponent('djTextBox1').getValue();

if (search == '')

{

query = ''

}

else 

{

var query = '';

query  = '(FIELD FirstName CONTAINS ' + search + '*)';

query += ' | ';

query += '(FIELD LastName CONTAINS ' + search + '*)';

};

viewScope.searchString = query;

 

In the search parameter of the view I have: viewScope.get('searchString')

 

 

I built a mobile Xpage with a Single Page Application control, and then some Application Page control inside that control, with a Data View in each Application Page Control. I use the same edit box and search code on the Data View, but it doesn't work. 

 

Is the search parm in a Data View any different from the search parm in a regular view?

Sep 23, 2013, 1:38 PM
30 Posts
response

hello Bryan,

i have done searh functions in my mobile apps (dataView control), and I did it like this.

1) Bind edit box to a Request variable:

 

 

2) in search property of a view, i have this code:

 

if  (requestScope.searchTxt != null)
    {  return requestScope.searchTxt + "*";}

 

 

3) Add button labeled "Search" of the submit type (to send request to the server)

It's simple way of doing it, and search works ok. Hope it helps!

Sep 23, 2013, 2:57 PM
13 Posts
That works but what about dynamic search

Thanks for the code. That works. But I was trying to duplicate some code I have working elsewhere (in a non-Mobile X-Page) that searchs the view every time the user types something in the input box. 

I do that by putting some javascript in the onKeyUp event and then do a partial refresh on the view panel. However, it appears the the partial update doesn't seem to work in the mobile pages. At least I cannot get it to fire consistently.

Oct 14, 2013, 6:01 PM
12 Posts
Search on iPhone

Hello,

I have built the search functionality in my mobile xpage, everything works when the user hits the custom "Search" button (the one with little magnifying glass in the picture below, which sets the requestScope). However, when the user hits the "Go" button that is provided by the iOS as part of the key pad, the search does not work as expected. The actual search result is displayed for a second and then the view gets loaded.

Is there a way to make the filed as Search field so that the Go button is replaced with "Search" as it happens in other websites?

Thanks,

Venkatesh

Search Screen

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal