开发者

Problem with displaying loader with Jquery UI Tabs

I was able to show "Retrieving Dat开发者_开发百科a.. " when user clicks on tab.

I want to show the same message on tab when user click on links which are inside of tabs.

Like in one of my tab I shows list of items with pagination. I want to show a message on tab like "Retrieving Data" when user click on pagination link for the items.

How can I do this ?


If you are sending an ajax request when pagination link clicked, you can set inside your pagination onclick handler the caption of active tab to "Retrieving Data" and inside success callback set the caption back. Something like:

$('.pagination_link').click(function () {
 var activeTab = $('.ui-widget-header').find('.ui-state-active a');
 var caption = activeTab.text();
 activeTab.text('Retrieving Data');
 $.ajax({
   //  ...request data...
  success: function (data) {
    activeTab.text(caption);
    // ... continue process your request
  }
 })

});

Maybe there is some API in jQuery UI that helps you to do this more jQueryUI-ish-way (for example more fancy selector of the current active tab and it's text), but the logic stay same. When using library it is just helps you to do some things more easy and fast, but you can always step aside library's trail and make what you want with help of javascript and logic. Is that what you asked?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜