implementing dynamic search - cursor problem

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

cagabit
Ebase User
Posts: 11
Joined: Fri Nov 20, 2015 6:10 pm

implementing dynamic search - cursor problem

#1

Postby cagabit » Fri Apr 29, 2016 6:42 pm

Hi,

Using v5.1.0

Trying to implement a search input for a table, fetched from the database.

The input box is a field control, when you type 3 or more characters the table is fetched with the criteria you wrote. Achieved like this:

- to the "html element properties" of the input field control, put a jquery event of keyup, in the code checking the length of the characters typed, if > 2 the serverside function called, the typed characters passed as parameter.
- serverside function is using the parameter string to set the field control's value, setting the where clause of the db resource and fetching the table with the new where clause.

up to this point it is working, but when the new table data fetched, the cursor in the input field is put to the beginning. Tried to put it to the end of the characters typed, by jquery code, after calling the serverside function but no luck ! Always the cursor is put to the beginning.

Here is the client jquery code:

Code: Select all

if ($(this).val().length >2) {
	$eb.executeFunction("searchContactFunction",$(this).val(),true);
}
and here is the serverside function code:

Code: Select all

function searchContactFunction (srcStr) {
			fields.searchFieldInput.value = srcStr;
			fields.whereClause.value = "'%" + srcStr + "%'";
			tables.contactsList_table.fetchTable();
}

Any ideas appreciated ?
0 x

cagabit
Ebase User
Posts: 11
Joined: Fri Nov 20, 2015 6:10 pm

#2

Postby cagabit » Sun May 01, 2016 6:13 am

Found a solution, for future reference:

I was trying to set the value of the searchField from client side by

Code: Select all

$(this).val()
which results in the cursor always at the first character.
But when used

Code: Select all

 $( "#searchBox" ).val("...")
it is ok. SearchBox is the id of the Locator, set from HTML element properties.
0 x


Who is online

Users browsing this forum: No registered users and 16 guests