Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
add a catalog table into colnames
14/12/2009
07:08
Avatar
francisco.penaranda
Member
Members
Forum Posts: 12
Member Since:
06/01/2009
sp_UserOfflineSmall Offline

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;
}

14/12/2009
16:17
Avatar
francisco.penaranda
Member
Members
Forum Posts: 12
Member Since:
06/01/2009
sp_UserOfflineSmall Offline

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;
}


15/12/2009
19:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information