3.2.0

Search Function / Auto-Complete in Grid

Dear all,

I'd like to be able use function auto-complete
(like this for example :http://www.codeproject.com/jscript/jsactb.asp )

1. key in the a. first letter of a TICKER or b. the whole ticker
2. this should auto-get all the data matching
3. same with dates (if user wants to find matching date data) ... etc

Solution would make scrolling down (if hundreds of items) unnecessary and user could find data faster.

If any one has any ideas/script... Wld appreciate it
ZMax
August 26,
I am also interested in such functionality, but if , as you said, there are hundreds of items (f.e matching "A" ) maybe the only solution could be paging (because of rendering delay).

Also Dates fields (wich I don't include) would be in yyyy/mm/dd format for a correct location.
I made a fast sample to test it:
http://www.telefonica.net/web2/webtress/awsamp/examples/autocomplete.html
Sorry if buggy and "Contais" function not working on numeric fields, but could give you an aprox. idea.
HTH
Carlos
August 27,
Very cool. Just doesn't seem to work when more than one letter is entered (for example in town name)

But that's the what i was talking about.

Zmax
August 31,
Sorry, does work, but need to remember to keep capital letters. Neat.
Zmax
August 31,
Carlos,

I have taken your script 1to1 (just changed the links in script src to correspond to my website) - and of course the .txt file.

Now following thing happens: page loads normal. but as soon as I enter a letter or word to be searched for the 'loading data, please wait' comes nonstop.

What cld reason for this be?
ZMax
September 2,
Try to put an aditional refresh after goToPage(0); (line 159) Althought it is not need of it cause is at the bottom of "function goToPage(delta){"
maybe a bigger Timeout (two lines below) change 0 with 2000 (two seconds), but no sense also.
If your txt file have mor/less columns need to check more things. I would suggest placing alerts() (myData or obj) in mentioned zone to discover it.
HTH
Carlos
September 2,
Great. That Did it.
ZMax
September 3,
If anyone wants to change button background color and have button hover effects; add this in grid.css:

.input.btn{color:#000000;font-family:helvetica,sans-serif;font-size:84%;font-weight:bold;background-color:#ffffff;border:1px solid;border-top-color:#000000;border-left-color:#000000;border-right-color:#000000;border-bottom-color:#000000;}.input.btnhov{border-top-color:#000000;border-left-color:#000000;border-right-color:#000000;border-bottom-color:#000000;background-color:#99CCFF;}

add this in page in html:
<button class="btn" onmouseover="this.className='btn btnhov'" onmouseout="this.className='btn'" onclick='goToPage(-Infinity)'>&lt;&lt;</button>

-etc for each button... maybe there's a way with less code?

And another question for Carlos, search function working; but when there are two or more pages it always jumps to last page. I wld like it to stay in first. (as it does in yours)... any ideas?

thx
ZMax
September 3,
I think it is caused when sorting and filter, so need to control somehow if is sorted and call "goToPage(0)"

Did not test it but maybe this function could give some help:
(click on headers can do normal sort plus any other thing)
http://activewidgets.com/javascript.forum.2094.5/context-menu-on-header.html
Thx

Carlos
September 4,
Thanks. Fixed it with first point.

Regarding Search Function:

a. Is it possible to choose ALL columns to be search for &
b. Is it possible to turn off case sensitivity? (A = a search)

Noticed that intuitively one enters search without regard to A or a.
ZMax
September 4,
You can search in all columns making a double loop, something like:
for(var x=0; x<GlobData.length; x++) {
for(var y=0; y<GlobData[x].length; y++) {
if ( GlobData[ x ][ y ].toUppe..............
.........


To do a case-insensitive search just change the lines:
if ( GlobData[ x ][ colToBeSearched ].substr(0, toSearch.length) == toSearch.substr(0, toSearch.length) ) {

with:
if ( GlobData[ x ][ colToBeSearched ].toUpperCase().substr(0, toSearch.length) == toSearch.toUpperCase().substr(0, toSearch.length) ) {

and also
if((GlobData[x][WhereToBeSearched].indexOf(toSearch)) >= 0) {

with:
if((GlobData[x][WhereToBeSearched].toUpperCase().indexOf(toSearch.toUpperCase())) >= 0) {



Carlos
September 4,
Sorry there is a mistake ( and cause the sample not working in "contain mode")

if((GlobData[x][WhereToBeSearched]............
should be:
if((GlobData[x][colToBeSearched ]........

I will correct today the online sample (including case-insensitive and all-columns filter)
Thanks
Carlos
September 4,
Forget my last post, I'll do some tests to fix this..
Thx
Carlos
September 4,
Solved,.... link updated !!
including case-insensitive and all-columns search
Carlos
September 4,
Perfect! Thx!
ZMax
September 4,
Hi All,

I want to know the javascript code to disable the Auto complete.
If any one has any ideas/script... I would appreciate it.
Amit
May 9,

This topic is archived.

See also:


Back to support forum