Forum



13:50

14/09/2010

If editoptions dataUrl have problem how can server response be displayed on form editing?
Some times, server respond with message to user which is not ajax error.
errorTextFormat event not fired.
afterSubmit too late.
documentations we haven't found an event with server response we can display on bottominfo for example.
hope someone helps. last message no one did.
thanks
21:36

07/10/2010

Hi
I have a similar problem as u. I want to get a list of a SELECT through a .php and this list would to fill the editoptions of a select type.
My is here:
$(document).ready(function(){
jQuery("#tabAreaCompetencia").jqGrid({
url:'areasConhecimento.php',
datatype: "xml",
colNames:['Código','Área Conhecimento', 'Código', 'Competência'],
colModel:[
{name:'codArea1',index:'codArea1', width:100,editable:true, editrules: { edithidden: true}},
{name:'areaConhecimento1',index:'areaConhecimento1', width:150, editable:true, edittype:"select", editoptions:{value:"1:one;2:two"}},
{name:'codCompetencia1',index:'codCompetencia1', width:100,editable:true,editrules: { edithidden: false}},
{name:'competencia1',index:'competencia1', width:100,editable:true,edittype:"select", editoptions: { dataUrl : '{areasConhecimento.php}' }},
],
rowNum:10,
rowList:[10,20,30],
pager: '#pagered',
sortname: 'areaConhecimento',
viewrecords: true,
sortorder: "desc",
caption:"Áreas de Conhecimento e Competências",
editurl:"areasConhecimento.php"
});
The column name 'competencia1' call .php... And the .php code is:
$sql = "SELECT conceito_id, descricao FROM area_conhecimento ORDER BY descricao ASC";
$res = mysql_query($sql);
$qtdeLinhas = mysql_num_rows($res);
$qtdeLinhas = $qtdeLinhas-1;
for ($i=0; $i<$qtdeLinhas; $i++){
$registro = mysql_fetch_row($res);
$cod = $registro[0];
$nome = $registro[1];
if ($i != $qtdeLinhas){
$resultado = $cod .":". $nome .";";
}
if ($i == $qtdeLinhas){
$resultado = $cod .":". $nome ."" ;
}
echo $resultado;
}
I imagine that the variable $resultado should return the string in this format: “FE:FedEx; IN:InTime; TN:TNT”. But unfortunately, it doesn't work.
I already have tried using ajax this way:
Instead of : editoptions: { dataUrl : '{areasConhecimento.php}' }, I tried: editoptions: {value:obterAreaConhecimento()}. In the code .php I get the list with this line:
$_POST['text'] = $resultado;
The function is:
function obterAreaConhecimento(){
urlConsultaArea = "./areasConhecimento.php";
$.ajax({
type: "get",
url: urlConsultaArea,
dataType: "text",
success: function(text){concatenaString(text)}
})
}
function concatenaString(text){
alert(text);
var editoptions = text;
alert(editoptions);
if (editoptions != ""){
return editoptions;
}
}
Alert shows the string with strange characters (6.02.00.00-6:Administra��o;6.02.01.00-2:Administra��o de Empresas;6.02.03.00-5:Administra��o de Setores Espec) and the select in the grid remains empty.
So, these 2 forms doesn't work yet.
How did you do? Maybe can we help each other.
[]`s
Most Users Ever Online: 715
Currently Online:
67 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