Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
auto search + true scroll+LIMIT range
27/11/2009
16:35
Avatar
MarkC
Member
Members
Forum Posts: 14
Member Since:
02/11/2009
sp_UserOfflineSmall Offline

Mark,

If you remember I was doing the project that searched a large amount of data with the auto search (onkeypress) functionality. I showed you a few demos. (but i never used a id, which you fixed)

All is working fine, except I came across a small problem which is related to the LIMIT (mysql) whilst scrolling. I fixed it, but i just wanted to run it by you to see if there was a better way.

Example:

Lets say i'm showing 20 (rownum=20) records in a grid with scroll:1, i have a 1000 records and i filter the grid on a keypress (like the advanced search bigset.php demo). If scrollbar is not touched all is fine, records are shown and filtered.

If i scroll to the bottom of the grid then i do a keypress to search the grid, if the record is in the data above (but out of range of teh LIMIT ) say the first 20 records out of 1000, then I get NO RECORDS found. UNless i then move the scrollbar to the top and the filtered grid is shown.

I understand why, because of the LIMIT in the SQL, as strStart might be 980 limiting for 20 records, but the filtered record is in the first 20 records (LIMIT 0,20).

I got round it by setting the scroll:0 and then to 1 like this:

'Filter data, turn off true scrolling to force grid to top.

$(”#list”).setGridParam({url:”newtabledata.asp?getItem=”+getItem+”&getBatch=”+getBatch+”&getCast=”+getCast,page:1,scroll:0}).trigger(”reloadGrid”);

'Refresh grid this forces scroll bar to pop to top and show data from 'above' if it didnt fall in the LIMIT range
$(”#list”).setGridParam({scroll:1}).trigger(”reloadGrid”);

Hope you understand what i mean.

Is there a nicer way to do this, like setting the scrollbar to the top of its range automatically.

Initailly i tried resetting the strStart to 0, if the search boxes had been keypressed, if sort of worked but still left the scrollbar at the bottom

Regards

MarkC

Can show a demo again if you need.

27/11/2009
17:57
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Hi Marc,

Yes, I understand the issue. It's comes up in a few places...

reloadGrid can now take an optional options object. One of the options is "page", which lets you specify the new page number after reload. I think if you set it to 1, you'll get the results you're after.

The only other option is "current", which preserves as much of the selection as it can (ie any rows which were selected before the reload, and are present after the reload, will be selected). Not relevant to the problem in hand, but I thought I'd mention it.

To pass options to a jQuery event handler, you have to wrap it in an array in the trigger call, resulting in the rather odd looking:

$(mygrid).trigger("reloadGrid", [{page:1}]);

Mark

29/11/2009
23:45
Avatar
MarkC
Member
Members
Forum Posts: 14
Member Since:
02/11/2009
sp_UserOfflineSmall Offline

Thanks Mark,

That did the trick.

Regards

Mark C.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
53 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information