Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with a gui requirement

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a search screen that populates multiple records on the same page as the search screen. There are two ways a user can navigate to get detail information pertaining to each record.

1. Double clicking the row.

2. highlighting the row and then clicking a "Get Detail" button present at the end of the screen.

Can anyone guide me of how this can be acheieved. Right now I display the search results as a table. I am not sure how I can highlight or allow user to click the record and show a detailed page.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the <tr> HTML element supports both an onclick an an ondblclick event. You can use these two events to accomplish what you want. You can write JavaScript attached to the onclick event to change the style of the row so that it has a darker background color and looks like it's highlighted. You can also determine which row was clicked by using the rowIndex property (this.rowIndex). Once you have that you can populate a hidded field that will tell which row's information to retrieve when the form is submitted.

When the ondblclick event occurs, you can populate a hidden field with the selected row, and then submit the form.

Since all of this has to be done in JavaScript, you've obviously got to have a bit of JavaScript skill. If you don't have that skill now, you're going to have to spend some time with tutorials and reference materials to get up to speed on JavaScript before you can write this.
[ February 21, 2007: Message edited by: Merrill Higginson ]
 
Arulanand Dayalan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try doing this way,



Define a javascript function called functionview and hit the action class to get details.

Hope this helps.

Thanks and Regards,
Arul.
 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for all your help. I am able to click on a row and open a detail screen(for now it is a welcome screen).

I need to transfer an Object(contains detailed info of the record) chosen to this page. The object has all the deatil information. How to proceed?

appreciate your reply.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion, trying to transfer the entire object from one JSP to another is not the best approach. The whole point of having a detail page is to display more information than you have on the "list" page. I'd suggest you just re-get the information from the database. That way you only have to pass the key, rather than an entire set of information.

For example, suppose your list is a list of customers, each of which has a customer ID. Just create an action called DisplayCustomerDetails that looks for a "customerId" parameter, gets the information from the database, and forwards to a JSP. Then when the user clicks the row, just pass the following URI:
 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx
 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to retrieve detail info by clicking the hyperlink. But I am unable to do so by cliking on the whole record itself. How do I retrieve the GroupId value based on the row highlighted. Is hidden field the only solution?
[ February 22, 2007: Message edited by: shah rah ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One solution would be to have server-side code insert the Group ID into the JavaScript code. Example:


[ February 22, 2007: Message edited by: Merrill Higginson ]
[ February 22, 2007: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic