Forum
Topic RSS
I have a catalog table "Vivientes" but in when I tried to add a field the editoption is not filling the catalog data, because i dont find some addoption or maybe I'm doing something wrong. To understand better here is part of my code:
....
colModel :[
{name:'idusuario', index:'idusuario', width:55,editable:false},
{name:'nombres', index:'nombres', width:90,editable:true},
{name:'fonos', index:'fonos', width:80, editable:true},
{name:'idvivientes', index:'idvivientes', width:80, editable:true, edittype:'select',editoptions:{dataUrl: 'ajax/commonactions.php?action=jqgridCombobox&idtable=idviviente&camposhow=nombres&table=Vivientes'}},
{name:'idgarage', index:'idgarage', width:80, align:'right', editable:true},
{name:'arrendado_a', index:'arrendado_a', width:90, editable:true},
{name:'negocio', index:'negocio', width:80, align:'right', editable:true},
{name:'depto_no', index:'depto_no', width:80, align:'right', editable:true},
{name:'piso_no', index:'piso_no', width:90, editable:true},
{name:'mail', index:'mail', width:80, align:'right', editable:true},
{name:'bloque', index:'bloque', width:80, align:'right', editable:true},
{name:'no_mascotas', index:'no_mascotas', width:150, sortable:false, editable:true}
],
....
and here is my php file
include_once("../settings/dbconnection.php");
$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
mysql_select_db($database) or die("Error conecting to db.");
extract($_REQUEST);
if ($action=="jqgridCombobox"){
$sql="select $idtable, $camposhow from $table order by $idtable";
$result1 = MYSQL_QUERY($sql);
$numberOfRows1 = @MYSQL_NUM_ROWS($result1);
for ($j=0;$j<$numberOfRows1;$j++){
$resultado[$j] = MYSQL_RESULT($result1,$j,$camposhow);
$idvar[$j] = @MYSQL_RESULT($result1,$j,$idtable);
if ($j==$numberOfRows1-1){$retorno.="$idvar[$j]:$resultado[$j]";}else{$retorno.="$idvar[$j]:$resultado[$j];";}
};
echo $retorno;
}
OK, i can do with php some trick to load this parameters, but is not an ajax action who loads dynamic information.
<? echo $somevariable; ?>,
and $somevariable= colModel :[name:........., editoptions:{value:"1:Cat1;2:Cat2;....."}]
greatings
Francisco
francisco.penaranda said:
I have a catalog table “Vivientes” but in when I tried to add a field the editoption is not filling the catalog data, because i dont find some addoption or maybe I'm doing something wrong. To understand better here is part of my code:
….
colModel :[
{name:'idusuario', index:'idusuario', width:55,editable:false},
{name:'nombres', index:'nombres', width:90,editable:true},
{name:'fonos', index:'fonos', width:80, editable:true},
{name:'idvivientes', index:'idvivientes', width:80, editable:true, edittype:'select',editoptions:{dataUrl: 'ajax/commonactions.php?action=jqgridCombobox&idtable=idviviente&camposhow=nombres&table=Vivientes'}},
{name:'idgarage', index:'idgarage', width:80, align:'right', editable:true},
{name:'arrendado_a', index:'arrendado_a', width:90, editable:true},
{name:'negocio', index:'negocio', width:80, align:'right', editable:true},
{name:'depto_no', index:'depto_no', width:80, align:'right', editable:true},
{name:'piso_no', index:'piso_no', width:90, editable:true},
{name:'mail', index:'mail', width:80, align:'right', editable:true},
{name:'bloque', index:'bloque', width:80, align:'right', editable:true},
{name:'no_mascotas', index:'no_mascotas', width:150, sortable:false, editable:true}
],….
and here is my php file
include_once(”../settings/dbconnection.php”);
$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die(”Connection Error: ” . mysql_error());
mysql_select_db($database) or die(”Error conecting to db.”);
extract($_REQUEST);
if ($action==”jqgridCombobox”){
$sql=”select $idtable, $camposhow from $table order by $idtable”;
$result1 = MYSQL_QUERY($sql);
$numberOfRows1 = @MYSQL_NUM_ROWS($result1);
for ($j=0;$j<$numberOfRows1;$j++){
$resultado[$j] = MYSQL_RESULT($result1,$j,$camposhow);
$idvar[$j] = @MYSQL_RESULT($result1,$j,$idtable);
if ($j==$numberOfRows1-1){$retorno.=”$idvar[$j]:$resultado[$j]“;}else{$retorno.=”$idvar[$j]:$resultado[$j];”;}
};
echo $retorno;
}
19:05
Moderators
30/10/2007
OfflineHello,
Maybe you can use setColProp method.
See docs
Best 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