best way to show editable search results in page

there will be search screen, once the user click search. we have to show the results, these results will have one editable field and i have show this like paging technique. worst case of search results will more that 1 lakh

i tried 2 ways 1. i taken the complete resultset and using javascript and dhtml i wrote the paging technique and after that i used session to store the selected rows. 2. i used rownum to build the paging technique but its very slow because it queries the DB every time once the user clicks next or previous links

both of the ways i am not happy, another alternate which i am thinking is: shall i take the entire resultset and place it in session object and apply the paging technique to this session object.

can anybody suggest best to do this, thinking in mind that these results are editable.

Retrieving the complete thing is useless, as you need to show just a few on the page. And the fact is the user might not browse all the pages. Hence, no need to query the complete set of records matching search criteria.

Having said that, you should get only the results you are going to show on your first page and query the database every time request come for the next. The detail of HOW-TO is given here.

Now, regarding editable results. Is there any problem in how to implement it? [ January 03, 2008: Message edited by: Adeel Ansari ]

ravi v kumar

Ranch Hand

Posts: 56

posted 10 years ago

hi adeel,

thanks for the post. as you said using pagination, its difficult to hold the user input like we will have check box for every result row and user can select a list of rows and go for submit. because with pagination, request will go to server every time if next or previous link is clicked.

take for example, user selects 2 rows in first page, and then he click next and then he selects 3 rows and then he clicks submit button. at this time we will data for only 3 row which was selected my user. the 2 rows selected my user in page one will be gone out of scope.

Adeel Ansari

Ranch Hand

Posts: 2874

posted 10 years ago

No, no , no. I mean think of this as a shopping cart thingy.

- Selecting records means putting things into the cart - Moving to the next page means browsing more stuff to choose - And submit means submitting the cart finally

Are you getting me?

Adeel Ansari

Ranch Hand

Posts: 2874

posted 10 years ago

Your last post got posted thrice. You can delete the extra two by editing your post. You find a checkbox "Delete Post" on your left on the edit page.

Thanks.

Adeel Ansari

Ranch Hand

Posts: 2874

posted 10 years ago

By the way, it doesn't really feel right to me that, the user must check the box to tell that this is the record I have modified. Isn't it like this?

If yes then, its good place to use AJAX. I mean, remove all your checkboxes. And make an AJAX call on onchange event to modify that particular record. There would be a number of advantages as well, like

- This way you don't have to keep track of selected records - Immediate response to the user - Clean, orderly and neat solution

ravi v kumar

Ranch Hand

Posts: 56

posted 10 years ago

hi adeel,

the requirement is same like you suggested. we will provide check box and we ever user selects some and clicks "ADD TO LIST" button, it will be added to his cart (i mean session variable). he can came again back to search a new result and repeat the above.

i did most of it, but the thing haulting me is query execution every page[pagination]. my search query joins 7 tables. executing this query infact 2 same query once count(*) and actual results for every page taking lot of time.

i am looking for indexing tables, views, tuning. i beleive 25k-50k records is not much data to apply pagination.

suggest me if had any info regarding tuning the query.

thanks again Ravi

Adeel Ansari

Ranch Hand

Posts: 2874

posted 10 years ago

Originally posted by ravi v kumar: i did most of it, but the thing haulting me is query execution every page[pagination]. my search query joins 7 tables. executing this query infact 2 same query once count(*) and actual results for every page taking lot of time.