Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






Dynamic Column Selects

No Tags
UserPost

18:00
03/03/2010


DOCMADRID

Member

posts 7

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;

?>

13:23
05/03/2010


tony

Sofia, Bulgaria

Moderator

posts 7392

Hello,

Please refer here:

http://www.trirand.com/blog/?p…..mp;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.

No Tags

About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

215


Currently Online:

ksbigfoot

53 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 10280

Posts: 30385

Membership:

There are 11049 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1210

markw65 – 179

kobruleht – 144

phicarre – 132

YamilBracho – 124

Renso – 118

Administrators: admin (60 Posts)

Moderators: tony (7392 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information