optikalefx / OpenJS-Grid

OpenJS Grid is the easiest jQuery Grid ever. With very little work you can have a data grid that can do everything from sorting and searching to complex database queries. Best of all, its open source. So you can learn how it's all done.
http://square-bracket.com/openjs
MIT License
96 stars 46 forks source link

populate an OpenJS grip based on the value #89

Open gkamal2 opened 9 years ago

gkamal2 commented 9 years ago

Hi,

I want to populate an OpenJS grip based on the value selected by the used on a drop down list. The calling script is time_data.php which extracts and populate the data. How can I achieve this ?

html PART

Id Name Time In Time Out Status Approval
  </body>

time_data.php <?php

// connect to db mysql_connect("localhost","root"," "); mysql_select_db("demo");

// require our class

require_once("lib/grid.php");
//
$grid = new Grid("tbl_time", array(
"save"=>true,
"delete"=>true, 
"editing"=>true,
"where"=>"time_grpc = 'CARP'", 
"joins"=> array(
           "LEFT JOIN tbl_tmstat ON (tmstat_code = time_stats)" 
     ),                 

"select" => 'selectFunction'
));  

// 'selectFunction'

function selectFunction($grid) {
    $selects = array();
//Session_start;
   // category select
    $grid->table = "tbl_tmstat";
    $selects["time_stats"] = $grid->makeSelect("tmstat_code","tmstat_name");

    // active select
    $selects["active"] = array("1"=>"true","0"=>"false");

    // render data          
    $grid->render($selects);
}`enter code here`
optikalefx commented 9 years ago

See this video for master-detail

https://www.youtube.com/watch?v=U5MGopAoQrM

You just need to add an action to your drop down to do what we're doing in this video for the child table.