Forum
Topic RSS
05:04
Moderators
30/10/2007
OfflineHello,
Which version do you use? Could you please post the code again with all functions and etc related to the grid?
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
04:13
20/02/2009
OfflineHello Tony,
I use version 3.4.
it's my code:
// definition des variables servant pour les mises à jour
var $profil_selection = '';
var $champ_metier_selection = '';
// initialisation de l'écran
function construction_grid()
{
$("#cod_inter_exter").hide();
const_grid_profil("profil");
}
function sorti()
{
$.ajax({
async: false,
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=fichier_task",
success: function(msg)
{
//alert(msg);
}
});
}
//Construction du grid profil
function const_grid_profil($type_requete)
{
jQuery(document).ready(function(){
jQuery("#profil").jqGrid({
url: $url_grid,
postData:{type_requete:$type_requete},
datatype: "json",
colNames:["Profil"],
colModel:[
{name:'nom_profil', index:'nom_profil', editable:true, width:50,sorttype:"text", editrules: {required:true}}
],
scroll:true,
pager: jQuery('#nav_profil'),
width:380,
pgbuttons: false,
pginput: false,
pgtext: false,
sortname: 'nom_profil',
sortorder: 'asc',
imgpath: $framework + 'jquery/jqgrid/themes/basic/images',
viewrecords: true,
gridComplete: function()
{
alert('1');
hauteur_grid("profil",15);
},
onSelectRow : function(id)
{
$profil_selection = id;
$("#td_champ_metier").show();
$("#cod_inter_exter").hide();
jQuery("#champ_metier").GridUnload();
const_grid_champ_metier("champ_metier",id);
}
}).navGrid('#nav_profil', {refresh:true,add:true,del:true,search:false,edit:true},
{ height:180,width:300,modal:true,url:'some.php',
beforeSubmit: function(id,test) { //réccuperation du code d'identification!
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=verif_modif_profil&nom_profil="+$("#nom_profil").val()+"&id="+id.id,
success: function(msg)
{
if (msg == "false")
{
alert("Le profil est utilisé !");
}
}
});
return "true";
}
}, //edit options
{ height:180, width:300, modal:true, url:'some.php',
beforeSubmit: function() { //réccuperation du code d'identification!
/*/dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php?requete=ajout_profil*/
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=verif_ajout_profil&nom_profil="+$("#nom_profil").val(),
success: function(msg)
{
if (msg == "false")
{
alert("Le profil existe déjà !");
}
}
});
return "true";
}
}, // add options
{ height:80,width:300, reloadAfterSubmit:true, modal:true, url:'some.php',
beforeSubmit: function(id) { //réccuperation du code d'identification!
/*var sr = jQuery('#client').getGridParam('selrow');
var rowData = jQuery('#client').getRowData(sr);
this.delData = {'invid': rowData['invid']};
//retarr = {'invid': rowData['invid']};
retarr = this.delData;
return retarr;*/
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=verif_suppr_profil&nom_profil="+id,
success: function(msg)
{
if (msg == "false")
{
alert("Le profil est utilisé !");
}
else
{
/*$("#champ_metier").hide();
$("#nav_champ_metier").hide(); */
$("#td_champ_metier").hide();
}
}
});
return "true";
}
}, // delete options
{modal:true,url:'some.php'
} // search options
);
});
}
//Construction du grid champ_metier
function const_grid_champ_metier($type_requete,$id)
{
jQuery(document).ready(function(){
jQuery("#champ_metier").jqGrid({
url:$url_grid,
postData:{type_requete:$type_requete,nom_profil:$id},
datatype: "json",
colNames:["Champ Metier"],
colModel:[
{name:'champ_metier', index:'champ_metier', width:20,sorttype:'text'}
],
pager: jQuery('#nav_champ_metier'),
pgbuttons: false,
pginput: false,
pgtext: false,
sortname: 'nom_element',
sortorder: 'asc',
width:380,
imgpath: $framework + '/jquery/jqgrid/themes/basic/images',
viewrecords: true,
gridComplete: function()
{
hauteur_grid("champ_metier",15);
},
onSelectRow : function($id)
{
$champ_metier_selection = $id;
cod_interne_externe($id,"chargement");
}
}).navGrid('#nav_champ_metier', {refresh:true,add:false,del:true,search:false,edit:false},
{ height:180,width:300,modal:true,url:'some.php'}, //edit options
{ height:180, width:300, modal:true, url:'some.php'}, // add options
{ height:80,width:300, reloadAfterSubmit:true, modal:true, url:'some.php',
beforeSubmit: function(id) { //réccuperation du code d'identification!
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=verif_suppr_champ_metier&id="+id,
success: function(msg)
{
$("#cod_inter_exter").hide();
}
});
return "true";
}
}, // delete options
{modal:true,url:'some.php'
}) // search options
.navButtonAdd('#nav_champ_metier',{
caption:'',
buttonimg:$framework + '/jquery/jqgrid/themes/basic/images/row_add.gif',
onClickButton: function()
{
$("#cod_inter_exter").hide();
ecran_champ_metier();
},
position:"first"});
});
}
function ecran_champ_metier()
{
var champ_metier = "";
$("#global").hide();
if ($("#ajout_champ_metier").html() != "" )
{
champ_metier = $("#filtre_champ_metier").val();
}
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=ecran_champ_metier&filtre_champ_metier="+champ_metier+"&id="+$profil_selection,
success: function(msg)
{
$("#ajout_champ_metier").html(msg);
}
});
}
function ajout_champ_metier(action,num_rows)
{
if (action == "quitter")
{
$("#ajout_champ_metier").html("");
$("#global").show();
}
else if (action == "ajouter")
{
var cod_champ_metier = "";
for (i = 1; i <= num_rows; i++)
{
if (document.getElementById("select_champ_metier_" + i).checked)
{
cod_champ_metier = cod_champ_metier + "|" + $("#select_champ_metier_" + i).val();
}
}
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=ajouter_champ_metier&cod_champ_metier="+cod_champ_metier+"&id="+$profil_selection,
success: function(msg)
{
jQuery("#champ_metier").trigger("reloadGrid");
ecran_champ_metier();
}
});
}
}
function cod_interne_externe($id,action)
{
if (action == 'chargement')
{
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=code_inter_exter&id=" + $id,
success: function(msg)
{
var reg=new RegExp("[-]+", "g");
var tableau=msg.split(reg);
$("#cod_inter_exter").show();
$("#cod_interne").val("");
$("#cod_externe").val("");
$("#cod_interne").val(tableau[0]);
$("#cod_externe").val(tableau[1]);
}
});
}
else if (action == 'change&cod_externe')
{
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=change_cod_externe&champ_metier_selection=" + $champ_metier_selection+"&cod_externe="+$("#cod_externe").val()+"&cod_interne="+$("#cod_interne").val(),
success: function(msg)
{
jQuery("#champ_metier").trigger("reloadGrid");
}
});
}
else if (action == 'change&cod_interne')
{
$.ajax({
type: "POST",
url: "../dematerialisation_facture/Traitement/gestion_profil_champs_metiers_ajax.php",
data: "requete=change_cod_interne&champ_metier_selection=" + $champ_metier_selection+"&cod_interne="+$("#cod_interne").val(),
success: function(msg)
{
jQuery("#champ_metier").trigger("reloadGrid");
}
});
}
}
/*
function hauteur_grid($nom_grid,$row_max)
{
var $num_row = jQuery("#" + $nom_grid).getGridParam('records');
//Si le nombre de ligne du grid est inférieur au nombre de lignes maximum souhaitées alors on règle la hauteur du grid pour afficher l'ensemble des lignes.
if ($num_row < $row_max)
{
jQuery("#" + $nom_grid).setGridHeight($num_row*21);
}//Sinon on affiche le nombre de lignes maximum souhaitées et le scroll permet de visualiser le reste.
else
{
jQuery("#" + $nom_grid).setGridHeight($row_max*21);
}
}*/
09:32
Moderators
30/10/2007
OfflineHello,
Sorry missed your post. Yes - it is a bug - I will check what I can do, but not promise.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 994
Currently Online:
35 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66
Log In
Home




