Yii Framework Forum: Cjuitabs, Open A Tab Using Jquery/javascript - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cjuitabs, Open A Tab Using Jquery/javascript CJuiTabs, jquery, javascript Rate Topic: -----

#1 User is offline   redpotatojae 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 07-June 13

Posted 07 January 2014 - 04:46 PM

Hello there,

I am trying to open a tab in CJuiTabs using jquery/javascript.
I can see the tab ID like #jw5_tab_2.
I would open a certain tab with refreshing the page using jquery/javascript, but I need to open a certain tab without refreshing.

i.e. there are 3 tabs (A, B, C)
1. click a checkbox
2. validate something and if the validate returns false, it needs to open 'B' tab

Could someone give me an idea how I can open a tab using jquery/javascript without refreshing a page.

Thanks,

Jae
0

#2 User is offline   redpotatojae 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 07-June 13

Posted 07 January 2014 - 05:28 PM

I found a way but not sure if there is easier way.
simply added/removed class.

$('#yw5 .ui-tabs-selected').removeClass('ui-state-active');
$('#yw5 .ui-tabs-selected').removeClass('ui-tabs-selected');

$('#yw5 .ui-tabs-panel').each(function(){
$(this).addClass('ui-tabs-hide');
});
$('#yw5 li:nth-child(3)').addClass('ui-state-active');
$('#yw5 li:nth-child(3)').addClass('ui-tabs-selected');
$('#yw5_tab_2').removeClass('ui-tabs-hide');
0

#3 User is offline   le_top 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 442
  • Joined: 08-June 10
  • Location:France (Ile-de-France/Val d'Oise)

Posted 26 February 2015 - 06:44 PM

In the latest version, you can do it like this if you assign a known id to the tab:
jQuery('#$tabsId').tabs("option","active",jQuery("#$tabsId a[href*='#$tabToSelectId']").parent().index());

0

#4 User is offline   RicardoOrozco 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 04-June 14
  • Location:Cali, Colombia

Posted 30 March 2015 - 08:04 AM

I do :P :

function hideTab(idTab) {
$("#" + idTab).hide();
$("#" + idTab).removeClass("ui-tabs-anchor");
}

function showTab(idTab) {
$("#" + idTab).show();
$("#" + idTab).addClass("ui-tabs-anchor");
}

function validateCheck() {
if ($("#IdCheck").is(":checked")) {

hideTab('ui-id-1');
hideTab('ui-id-2');

showTab('ui-id-3');
showTab('ui-id-4');

$("#ui-id-3").click();//for change visible tab

} else {
showTab('ui-id-1');
showTab('ui-id-2');

hideTab('ui-id-3');
hideTab('ui-id-4');

$("#ui-id-1").click();

}
}
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users