I have, in PHP
, a method whose code returns values, passing them to a View
, as in the block below:
return view('PesquisaView')
->with('clientes',$resultadoClientes)
->with('advs',$resultadoAdvs)
->with('bps',$resultadoBPs)
->with('mensagemDoUploadRemessa',$avisoUpload);
However, this View has several tabs based on the Boostrap framework and 'return' displays the View on the first tab, the one that was set to 'active' at the beginning of page usage.
I would like the 'return' statement, which causes the View to open, directly display the tab I want, not 'default'. In the case of 'id' 'IdPaneCitiSearchRemessa'.
The html code that defines the tabs is
<ul class="nav nav-tabs">
<li><a href="#idQExpert" data-toggle="tab">QExpert</a></li>
<li>
<a href="#idPaneCitiPesquisarRemessa" data-toggle="tab">Citibank - Remessa</a>
</li>
<li>
<a href="#idPaneCitiPesquisar" data-toggle="tab">Citibank - Retorno</a>
</li>
</ul>
Update:
Taking advantage of the valuable suggestion of @Virgilio Novic (as well as those of @wmengue and @massreuy), I changed my code to the following:
Method in PHP:
$tab = 2;
return view('PesquisaView')
->with('clientes',$resultadoClientes)
->with('advs',$resultadoAdvs)
->with('bps',$resultadoBPs)
->with('mensagemDoUploadRemessa',$avisoUpload);
->with('tab',$tab);
HTML markup:
<ul class="nav nav-tabs" id="myTab">
<li class="{{$tab==1?'active':''}}"><a href="#idQExpert" data-toggle="tab">QExpert</a></li>
<li class="{{$tab==2?'active':''}}"><a href="#idPaneCitiPesquisarRemessa" data-toggle="tab">Citibank - Remessa</a>
</li>
<li class="{{$tab==3?'active':''}}">
<a href="#idPaneCitiPesquisar" data-toggle="tab">Citibank - Retorno</a>
</li>
</ul>
After executing the method, it returns the value 2 for the $ tab variable, the View blade accepts the parameter and highlights the 'Citibank - Shipping' tab (the middle tab in the image below, which has the white background ), but notice that the content, which is a html form, does not appear.
However,ifthetabsareclicked,forpageexchange,bethefirstorthethirdand,backtothesecond,thentheformisrendered,asnewimagebelow:
That is, the click event does not happen when it becomes the active class via code.