Forum

May 22nd, 2014
A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

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

Topic RSS
Dynamic Column Selects
03/03/2010
18:00
DOCMADRID
Member
Forum Posts: 7
Member Since:
03/03/2010
Offline

Hi everyone,

First of all thanks for the great support and lessons i am getting with this forum, really helpful!

Im working for the first time with JqGrid and Im lost trying to get dynamic combos in 3 of my grid columns…I have read a lot of Topics about and they focus on the dynamic selects in the edit mode, so i couldnt find the solution for the "normal" column selects linking.

The thing, as you can image, is about a table with the columns  "Region" "City" "Hospital", the selects get the options from a sql table but they are not linked and when the user select a region the second select is still displaying all the cities of the country, not only the cities relatives to that region, and the same with City and Hospital…I think you know what i mean, you can see the app online here "http://willbe.orgfree.com/ConsultAmiR/consultamirDemos/demos/demo1/consultamir.php"

I can post my code if you want, is there any chance to get that not so complicated (remember im new with JqGrid:)

Many thanks

Jonathan

PS: my grid.php code

// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT Numero , Convocatoria, Especialidad, Provincia, Localidad, Centro FROM adjudicamir09';
// Set output format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
// Set some grid options
$grid->setGridOptions(array(
        "rowNum"=>20,
        "sortname"=>"Numero",
        "caption"=>"ConsultAmiR 09 | Abre este panel y busca lo que necesites! | MUCHA SUERTE | Equipo AMIR",
        "rownumbers"=>true,
        "rownumWidth"=>30,
        "autowidth"=>true,
        "height"=>'auto',
        "scroll"=>0,
        "hiddengrid"=>true,
         ));

$grid->setColProperty("Numero", array("label"=>"Numero", "width"=>90, "search"=>true, "align"=>"center"));
$grid->setColProperty("Especialidad", array("label"=>"Especialidad", "width"=>200));
$grid->setColProperty("Provincia", array("label"=>"Provincia", "width"=>200));
$grid->setColProperty("Localidad", array("label"=>"Localidad", "width"=>150));
$grid->setColProperty("Centro", array("label"=>"Centro", "width"=>500));
$grid->setColProperty("Convocatoria", array("label"=>"Convocatoria", "width"=>90, "align"=>"center"));

// Enable filter toolbar searching
$grid->toolbarfilter = true;

// we set the select

$grid->setSelect("Localidad", "SELECT DISTINCT Localidad, Localidad AS Provincia FROM adjudicamir09 ORDER BY `adjudicamir09`.`localidad` ASC", false, false, true, array(""=>"Todas"));
$grid->setSelect("Provincia", "SELECT DISTINCT Provincia, Provincia AS Provincia FROM adjudicamir09 ORDER BY `adjudicamir09`.`Provincia` ASC", true, true, true, array(""=>"Todas"));
$grid->setSelect("Especialidad", "SELECT DISTINCT Especialidad, Especialidad AS Especialidad FROM adjudicamir09 ORDER BY `adjudicamir09`.`Especialidad` ASC", false, false, true, array(""=>"Todas"));
$grid->navigator = true;
$grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>true, "search"=>true));
$grid->setSelect("Centro", "SELECT DISTINCT Centro, Centro AS Centro FROM adjudicamir09 ORDER BY `adjudicamir09`.`Centro` ASC", false, false, true, array(""=>"Todos"));
$grid->setSelect("Convocatoria", "SELECT DISTINCT Convocatoria, Convocatoria AS Convoctoria FROM adjudicamir09 ORDER BY `adjudicamir09`.`Convocatoria` DESC", false, false, true, array(""=>"Todas"));

$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;

?>

05/03/2010
13:23
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7580
Member Since:
30/10/2007
Offline

Hello,

Please refer here:

http://www.trirand.com/blog/?p…..38;ret=all

Regards

Tony

For professional UI suites for PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site - trirand.net - by the very same guys that created jqGrid.
Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
45 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1219

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11243

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10447

Posts: 30878

Newest Members: JoHansen, manjunathmaski, blgsyrmhnds, toadicusrex, re-gor, NoSalt

Moderators: tony (7580), Rumen[Trirand] (81)

Administrators: admin (61)

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information