Display result without reloading page

Hi all...

  I have a tabbed interface for showing the details of an Item. By
default the 'Details' tab is selected. The code for displaying each tab
is in a partial file.

In one tab named 'status', i'm showing the list of status history of
that item. I am trying to implement pagination for this list.
When i click on the 'next' link to view the next page, the entire page
get reloaded and return to 'Details' tab which is selected by default. I
just want to display the next page in the 'status' tab without
reloading.

How can i do this? Please help.

Thanks in advance
Suneeta

Hi,
By default, the link tag will post the page. In your case, the
pagination value (i.e.) the page number will be sent by GET method. I
hope you can see the page variable in the URL.
Coming to your problem, i am sure you should have some flag variable to
differentiate between each tabs. So try to post (POST or GET method)
that variable through java script from the Link tag.
Hope it resolves your problem.

Regards,
VASANTH

Suneeta Km wrote:

Hi,

The link tag are:

<table class='paginationtable' align='right'>
    <tr align='center'>
    <td>
     <%= link_to('Previous', {:params => params.merge('page' =>
@hardware_ci_status_histories_pages.current.previous)}) if
@hardware_ci_status_histories_pages.current.previous %>
     <%= pagination_links(@hardware_ci_status_histories_pages,{:params
=> params.merge('ci'=>@ci.id)}) %>
     <%= '' if @hardware_ci_status_histories_pages.current.previous and
@hardware_ci_status_histories_pages.current.next %>
     <%= link_to('Next', {:params => params.merge('page' =>
@hardware_ci_status_histories_pages.current.next)}) if
@hardware_ci_status_histories_pages.current.next %>
    </td>
    </tr>
   </table>

I have an id for differentiating each tab. The id for the 'status' tab
is 'cistatushistory'. Can you please show me how to pass this id through
javascript from the link tag?

Thank you for your reply
Regards
Suneeta

Vasanthakumar Csk wrote:

Hi,
Thank you so much for your reply. I tried giving the id as parameter.
But it didn't show any diference. When we click on the 'next' link the
page is reloaded and the 'Detail' tab is selected.

Should I use ajax calls here inorder to prevent the page from being
reloaded?
Any idea about this?

Regards
Suneeta

Vasanthakumar Csk wrote:

Suneeta Km wrote:
Hi,
   Thank you so much for your reply. I tried giving the id as parameter.
   But it didn't show any diference. When we click on the 'next' link
the
   page is reloaded and the 'Detail' tab is selected.
   With this id what are the operations to be made?
  Should I use ajax calls here inorder to prevent the page from being
  reloaded?
  Any idea about this?

  Regards
  Suneeta

Hi,
In the onclick event of the tabs you will pass some variable right?
Either to normal posting methods or AJAX calls. I suppose that variable
would be "id". If thats the case then use this condition before passing
to posting methods or AJAX calls,
if(params[:id])
     id = params[:id] # so ur 'cistatushistory' will be stored in 'id'
end

Regards,
VASANTH

Suneeta Km wrote:

There is a very interesting discussion of tabs in Rails located here:
http://www.therailsway.com/2007/6/28/free-for-all-tab-helper-summary