Page 1 of 1

Visualize and Add Icons not always displayed when viewed in a tab

Posted: 2019-01-12 21:21
by rprevost
Hello to all of you. I wish you all a happy new year.
I noticed an annoyance while browsing the application I am working with:
Lookup fields (showing a dropdown list from another table) do not always show the accompanied visualize and add icons when they are displayed in a tab. This behaviour is not present if the lookup field is displayed as ususal (not a part of a tab).

The thing is that sometimes a given lookup field in a tab is displaying the icons correctly and a few moments later the icons are not displayed. This is very annoying since the "Eye icon" is very usefull in order to get some details about the lookup field.

I tried to refresh the browser (F5), but it did not work. Since I need this functionality badly, I persisted in finding a solution and I did :

If the "Eye and Plus" icons do not display in the tab, all you have to do is grab the right side of the window browser and move it a little. By magic, the icons will reappear properly.

I hope this will help other. Also, it might give enough information to Mr. Geany so he can have a look at this.
Regards,

Re: Visualize and Add Icons not always displayed when viewed in a tab

Posted: 2019-01-24 14:45
by a.gneady
all you have to do is grab the right side of the window browser and move it a little
Hmm ... that sounds like a window resize event needs to be triggered after placing the fields in a tab ... you could add this code after moving fields to tabs:

Code: Select all

$j(window).resize();
If it doesn't work, try introducing a small delay like that:

Code: Select all

setTimeout(function() { $j(window).resize(); }, 1000)

Re: Visualize and Add Icons not always displayed when viewed in a tab

Posted: 2019-02-25 18:09
by rprevost
Hello,

Thank you for the suggestions. I tried both but it is still not working. Here is another piece of information that might give you a clue on the source of the problem :
- When I display the detail view page, all relevant fields on the main section of the page show the appropriate icons.
- If I click on a tab (let say: A) with lookup fields, the icons do not show until I manually resize the window.
- Then, if I click on another tab (let say: B), the icons do not show either. I have to manually re-resize the window.
- Now if I go back and click on tab A a second time, the icons all show. Same with tab B.

Idea: Maybe the refresh window should be triggered by a click on the tab button.

Regards,

Re: Visualize and Add Icons not always displayed when viewed in a tab

Posted: 2019-02-27 13:21
by a.gneady
Could you post the code you are using to have a better idea of what is causing this please?

Re: Visualize and Add Icons not always displayed when viewed in a tab

Posted: 2019-02-28 19:10
by rprevost
Hopefully this will help you identify the source of the problem.

This part of the stage.php file in the Hooks directory:

function stage_dv($selectedID, $memberInfo, &$html, &$args){

/* if this is the print preview, don't modify the detail view */
if(isset($_REQUEST['dvprint_x'])) return;

ob_start(); ?>

<div id="form-tabs">
<ul class="nav nav-tabs">
<li class="active"><a href="#stage-info" data-toggle="tab">Stage</a></li>
<li><a href="#stagiaire-info" data-toggle="tab">Stagiaire</a></li>
<li><a href="#super-info" data-toggle="tab">Superviseur</a></li>
<li><a href="#ecole-info" data-toggle="tab">&Eacute;cole</a></li>
<li><a href="#installation-info" data-toggle="tab">Installation</a></li>
<li><a href="#direction-info" data-toggle="tab">Direction</a></li>
<li><a href="#securite-info" data-toggle="tab">S&eacute;curit&eacute;</a></li>
<li><a href="#gestion-info" data-toggle="tab">Gestion</a></li>
</ul>

<ul class="tab-content">
<div class="tab-pane active form-horizontal" id="stage-info"></div>
<div class="tab-pane form-horizontal" id="stagiaire-info"></div>
<div class="tab-pane form-horizontal" id="super-info"></div>
<div class="tab-pane form-horizontal" id="ecole-info"></div>
<div class="tab-pane form-horizontal" id="installation-info"></div>
<div class="tab-pane form-horizontal" id="direction-info"></div>
<div class="tab-pane form-horizontal" id="securite-info"></div>
<div class="tab-pane form-horizontal" id="gestion-info"></div>

</ul>
</div>

<style>
#form-tabs .nav-tabs a{ display: block !important; }
@media (min-width: 768px){
.form-inline .form-group{
width: 48%;
margin-bottom: 0.75em;
vertical-align: top;
}
}
</style>

<script>
$j(function(){
$j('#form-tabs').appendTo('#stage_dv_form');

/* fields to move to the stage info tab */
$j('#sta_type').parents('.form-group').appendTo('#stage-info');
$j('#sta_note').parents('.form-group').appendTo('#stage-info');

/* fields to move to the stagiaire info tab */
$j('#etu_codeperm').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_datenaiss').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_telephone').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_courriel').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_form1nom').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_form1inscdate').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_form1confdate').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_form2nom').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_form2inscdate').parents('.form-group').appendTo('#stagiaire-info');
$j('#etu_form2confdate').parents('.form-group').appendTo('#stagiaire-info');
$j('#sta_no').parents('.form-group').appendTo('#stagiaire-info');

/* fields to move to the super info tab */
$j('#sta_clientele').parents('.form-group').appendTo('#super-info');
$j('#sta_superforma').parents('.form-group').appendTo('#super-info');
$j('#ges_form1nom').parents('.form-group').appendTo('#super-info');
$j('#ges_form1inscdate').parents('.form-group').appendTo('#super-info');
$j('#ges_form1confdate').parents('.form-group').appendTo('#super-info');
$j('#ges_form2nom').parents('.form-group').appendTo('#super-info');
$j('#ges_form2inscdate').parents('.form-group').appendTo('#super-info');
$j('#ges_form2confdate').parents('.form-group').appendTo('#super-info');
$j('#sta_cosupernom').parents('.form-group').appendTo('#super-info');
$j('#sta_supervautres').parents('.form-group').appendTo('#super-info');


/* fields to move to the ecole info tab */
$j('#etu_hspnet').parents('.form-group').appendTo('#ecole-info');
$j('#etu_medsis').parents('.form-group').appendTo('#ecole-info');
$j('#etu_sigle').parents('.form-group').appendTo('#ecole-info');
$j('#etu_sigle_nomcours').parents('.form-group').appendTo('#ecole-info');
$j('#etu_scolniv').parents('.form-group').appendTo('#ecole-info');
$j('#etu_scolan').parents('.form-group').appendTo('#ecole-info');
$j('#sta_hresnbrlu').parents('.form-group').appendTo('#ecole-info');
$j('#sta_hresnbrfaites').parents('.form-group').appendTo('#ecole-info');
$j('#ges_argent').parents('.form-group').appendTo('#ecole-info');
$j('#ges_argentmontant').parents('.form-group').appendTo('#ecole-info');
$j('#ins_note').parents('.form-group').appendTo('#ecole-info');
$j('#etu_secteur').parents('.form-group').appendTo('#ecole-info');
$j('#sta_enseignant').parents('.form-group').appendTo('#ecole-info');
$j('#sta_enseigntel').parents('.form-group').appendTo('#ecole-info');
$j('#sta_enseigncourriel').parents('.form-group').appendTo('#ecole-info');



/* fields to move to the installation info tab */
$j('#ins_constituante').parents('.form-group').appendTo('#installation-info');
$j('#ins_rue').parents('.form-group').appendTo('#installation-info');
$j('#ins_villeprov').parents('.form-group').appendTo('#installation-info');
$j('#ins_cp').parents('.form-group').appendTo('#installation-info');
$j('#ins_codecourriel').parents('.form-group').appendTo('#installation-info');
$j('#ins_adresse').parents('.form-group').appendTo('#installation-info');
$j('#ins_codecourriel').parents('.form-group').appendTo('#installation-info');
$j('#ins_nocarte_groupe').parents('.form-group').appendTo('#installation-info');
$j('#ins_repprenom').parents('.form-group').appendTo('#installation-info');
$j('#ins_repnom').parents('.form-group').appendTo('#installation-info');


/* fields to move to the direction info tab */
$j('#ins_directionadj').parents('.form-group').appendTo('#direction-info');
$j('#ins_coordination').parents('.form-group').appendTo('#direction-info');
$j('#ins_programme').parents('.form-group').appendTo('#direction-info');
$j('#ins_chefservice').parents('.form-group').appendTo('#direction-info');
$j('#ins_chefservicecourriel').parents('.form-group').appendTo('#direction-info');
$j('#ins_chefservicetel').parents('.form-group').appendTo('#direction-info');
$j('#ins_chefserviceua').parents('.form-group').appendTo('#direction-info');



/* fields to move to the securite info tab */
$j('#ges_antejudidate').parents('.form-group').appendTo('#securite-info');
$j('#etu_commrh').parents('.form-group').appendTo('#securite-info');
$j('#ges_noreqinformat').parents('.form-group').appendTo('#securite-info');
$j('#ins_typecarte').parents('.form-group').appendTo('#securite-info');
$j('#ges_cartestatu').parents('.form-group').appendTo('#securite-info');
$j('#ges_carteno').parents('.form-group').appendTo('#securite-info');
$j('#sta_supernocarte').parents('.form-group').appendTo('#securite-info');
$j('#ins_cartegestion').parents('.form-group').appendTo('#securite-info');
$j('#ges_carteenvoidate').parents('.form-group').appendTo('#securite-info');
$j('#ges_cartenote').parents('.form-group').appendTo('#securite-info');


/* fields to move to the gestion info tab */
$j('#ges_accueilinvitation').parents('.form-group').appendTo('#gestion-info');
$j('#ges_accueiljour').parents('.form-group').appendTo('#gestion-info');
$j('#ges_accueilheure').parents('.form-group').appendTo('#gestion-info');
$j('#etu_acceu_present').parents('.form-group').appendTo('#gestion-info');
$j('#ges_messstadate').parents('.form-group').appendTo('#gestion-info');
$j('#ges_messsupdate').parents('.form-group').appendTo('#gestion-info');
$j('#ges_note').parents('.form-group').appendTo('#gestion-info');


})
</script>


<?php
$tabs = ob_get_contents();
ob_end_clean();

$html .= $tabs;
$html = str_replace('showSeconds: true', 'showSeconds: false', $html);

}

Re: Visualize and Add Icons not always displayed when viewed in a tab

Posted: 2019-05-04 20:02
by pbottcher
Hi,

I think this is a bug. I could reproduce it and if the select a value on the first lookup both icons (visualize and add)disapear as there is now window.resize happening

in order to circumvent it I put in the hoosks/TABLENAME-dv.js script

Code: Select all

$j(function () {
	$j( document ).ajaxSuccess(function( event, xhr, settings ) {
		var re=new RegExp(/TABLENAME_autofill.php\?rnd1=&mfk=/);
		if (re.test(settings.url)) {
			$j(window).resize();
		}		
	});
})
where you need to replace TABLENAME by your tablename for the dv.