jqgrid主从表查询+添加grid按钮+查询框的“X”取消+查询框去掉
来源:互联网 发布:淘宝人工云客服没有了 编辑:程序博客网 时间:2024/05/16 17:03
public function maingrid(){
// jqgrid查询
Vendor('jqSuite.jqGrid');
Vendor('jqSuite.jqGridPdo');
$conn = new PDO(C('GRIDB.DSN'),C('GRIDB.USER'),C('GRIDB.PWD'));
$conn->query("SET NAMES utf8");
$grid = new jqGridRender($conn);
// Write the SQL Query
$sqlx = "SELECT a.org_id,a.org_no as user_name,a.org_name,a.phone,a.email,a.address,a.consume_money,a.balance";
$sqlx .= " FROM ".C('DB_PREFIX')."tenants AS a ";
// $sqlx .= " WHERE a.user_id = ".$this->user_id." AND a.org_id = ".$this->org_id;
$grid->SelectCommand = $sqlx;
// Set the table to where you update the data
$grid->table = C('DB_PREFIX').'tenants';
// 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('index.php?m=Member&a=maingrid');
// Set some grid options
$grid->setGridOptions(array(
"rowNum"=>15,
"height"=>450,
"gridview"=>false,
"rowList"=>array(10,15,20,25,30),
// "sortname"=>"user_id",
"sortorder"=>"desc",
"rownumbers"=>true,
"autowidth"=>true,
));
$grid->addCol(array(
"name"=>"action",
"editable"=>false,
"sortable"=>false,
"resizable"=>false,
"fixed"=>true,
// "height"=>450,
// "formatoptions"=>array("bSubmit"=>true)
), "last");
// $grid->setColProperty('org_id', array("label"=>"ID", "width"=>50));
$grid->setColProperty('org_id', array("label"=>"id", "width"=>50));
$grid->setColProperty('user_name', array("label"=>"用户名", "width"=>50));
$grid->setColProperty('org_name', array("label"=>"公司名称", "width"=>50));
$grid->setColProperty('phone', array("label"=>"电话", "width"=>50));
$grid->setColProperty('email', array("label"=>"邮箱", "width"=>50));
$grid->setColProperty('address', array("label"=>"地址", "width"=>50));
$grid->setColProperty('consume_money', array("label"=>"消耗金额", "width"=>80));
$grid->setColProperty('balance', array("label"=>"可用余额", "width"=>50));
$grid->setColProperty('action', array("label"=>"操作", "width"=>250,"formatter"=>"js:actions",'align'=>'center'));
$grid->setColProperty('action', array("label"=>"操作", "width"=>200,"formatter"=>"js:actions","search"=>false));
$actions=<<<ACTION
function actions(callValue,options,rowObject)
{
return '<button class="btn btn-success" onclick="check(this,\'reset\');">重置密码</button> <button class="btn btn-warning" onclick="check(this,\'recharge\');">充值</button>';
}
ACTION;
$grid->setJSCode($actions);
// $grid->setGridEvent('onSelectRow', $selectorder);
// Enable navigator
$grid->toolbarfilter=true;
$grid->setSubGridGrid("index.php?m=Member&a=subgrid");
$grid->navigator = false;
// Enable only editing
$grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>false));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
}
public function subgrid(){
Vendor('jqSuite.jqGrid');
Vendor('jqSuite.jqGridPdo');
$conn = new PDO(C('GRIDB.DSN'),C('GRIDB.USER'),C('GRIDB.PWD'));
$conn->query("SET NAMES utf8");
$subtable = jqGridUtils::Strip($_REQUEST["subgrid"]);
$rowid = jqGridUtils::Strip($_REQUEST["rowid"]);
if(!$subtable && !$rowid) die("Missed parameters");
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT SUBSTRING(c.product_name ,1,POSITION("(" IN c.product_name)-1) as pname,b.use_quantity,b.buy_quantity-b.use_quantity as unused FROM '.C('DB_PREFIX').'tenantsproduct AS b LEFT JOIN '.C('DB_PREFIX').'products AS c ON b.product_id = c.product_id WHERE org_id= ?';
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setColModel(null, array(&$rowid));
// Set the url from where we obtain the data
// $grid->setUrl('index.php?m=Member&a=maingrid');
// Set some grid options
$grid->setUrl('index.php?m=Member&a=subgrid');
$grid->setGridOptions(array(
"autowidth"=>true,
"postData"=>array("subgrid"=>$subtable,"rowid"=>$rowid)));
// Change some property of the field(s)
$grid->setColProperty('pname', array("label"=>"产品名称", "width"=>50,"align"=>"center"));
$grid->setColProperty('use_quantity', array("label"=>"使用数量", "width"=>50,"align"=>"center"));
$grid->setColProperty('unused', array("label"=>"未使用数量", "width"=>50,"align"=>"center"));
$subtable = $subtable."_t";
$pager = $subtable."_p";
$grid->renderGrid($subtable,$pager, true, null, array(&$rowid), true,true);
$conn = null;
}
// jqgrid查询
Vendor('jqSuite.jqGrid');
Vendor('jqSuite.jqGridPdo');
$conn = new PDO(C('GRIDB.DSN'),C('GRIDB.USER'),C('GRIDB.PWD'));
$conn->query("SET NAMES utf8");
$grid = new jqGridRender($conn);
// Write the SQL Query
$sqlx = "SELECT a.org_id,a.org_no as user_name,a.org_name,a.phone,a.email,a.address,a.consume_money,a.balance";
$sqlx .= " FROM ".C('DB_PREFIX')."tenants AS a ";
// $sqlx .= " WHERE a.user_id = ".$this->user_id." AND a.org_id = ".$this->org_id;
$grid->SelectCommand = $sqlx;
// Set the table to where you update the data
$grid->table = C('DB_PREFIX').'tenants';
// 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('index.php?m=Member&a=maingrid');
// Set some grid options
$grid->setGridOptions(array(
"rowNum"=>15,
"height"=>450,
"gridview"=>false,
"rowList"=>array(10,15,20,25,30),
// "sortname"=>"user_id",
"sortorder"=>"desc",
"rownumbers"=>true,
"autowidth"=>true,
));
$grid->addCol(array(
"name"=>"action",
"editable"=>false,
"sortable"=>false,
"resizable"=>false,
"fixed"=>true,
// "height"=>450,
// "formatoptions"=>array("bSubmit"=>true)
), "last");
// $grid->setColProperty('org_id', array("label"=>"ID", "width"=>50));
$grid->setColProperty('org_id', array("label"=>"id", "width"=>50));
$grid->setColProperty('user_name', array("label"=>"用户名", "width"=>50));
$grid->setColProperty('org_name', array("label"=>"公司名称", "width"=>50));
$grid->setColProperty('phone', array("label"=>"电话", "width"=>50));
$grid->setColProperty('email', array("label"=>"邮箱", "width"=>50));
$grid->setColProperty('address', array("label"=>"地址", "width"=>50));
$grid->setColProperty('consume_money', array("label"=>"消耗金额", "width"=>80));
$grid->setColProperty('balance', array("label"=>"可用余额", "width"=>50));
$grid->setColProperty('action', array("label"=>"操作", "width"=>250,"formatter"=>"js:actions",'align'=>'center'));
$grid->setColProperty('action', array("label"=>"操作", "width"=>200,"formatter"=>"js:actions","search"=>false));
$actions=<<<ACTION
function actions(callValue,options,rowObject)
{
return '<button class="btn btn-success" onclick="check(this,\'reset\');">重置密码</button> <button class="btn btn-warning" onclick="check(this,\'recharge\');">充值</button>';
}
ACTION;
$grid->setJSCode($actions);
// $grid->setGridEvent('onSelectRow', $selectorder);
// Enable navigator
$grid->toolbarfilter=true;
$grid->setSubGridGrid("index.php?m=Member&a=subgrid");
$grid->navigator = false;
// Enable only editing
$grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>false));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
}
public function subgrid(){
Vendor('jqSuite.jqGrid');
Vendor('jqSuite.jqGridPdo');
$conn = new PDO(C('GRIDB.DSN'),C('GRIDB.USER'),C('GRIDB.PWD'));
$conn->query("SET NAMES utf8");
$subtable = jqGridUtils::Strip($_REQUEST["subgrid"]);
$rowid = jqGridUtils::Strip($_REQUEST["rowid"]);
if(!$subtable && !$rowid) die("Missed parameters");
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT SUBSTRING(c.product_name ,1,POSITION("(" IN c.product_name)-1) as pname,b.use_quantity,b.buy_quantity-b.use_quantity as unused FROM '.C('DB_PREFIX').'tenantsproduct AS b LEFT JOIN '.C('DB_PREFIX').'products AS c ON b.product_id = c.product_id WHERE org_id= ?';
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setColModel(null, array(&$rowid));
// Set the url from where we obtain the data
// $grid->setUrl('index.php?m=Member&a=maingrid');
// Set some grid options
$grid->setUrl('index.php?m=Member&a=subgrid');
$grid->setGridOptions(array(
"autowidth"=>true,
"postData"=>array("subgrid"=>$subtable,"rowid"=>$rowid)));
// Change some property of the field(s)
$grid->setColProperty('pname', array("label"=>"产品名称", "width"=>50,"align"=>"center"));
$grid->setColProperty('use_quantity', array("label"=>"使用数量", "width"=>50,"align"=>"center"));
$grid->setColProperty('unused', array("label"=>"未使用数量", "width"=>50,"align"=>"center"));
$subtable = $subtable."_t";
$pager = $subtable."_p";
$grid->renderGrid($subtable,$pager, true, null, array(&$rowid), true,true);
$conn = null;
}
0 0
- jqgrid主从表查询+添加grid按钮+查询框的“X”取消+查询框去掉
- 添加输入框以及查询按钮
- jqgrid查询
- jqGrid查询
- jqGrid的多字段查询
- jqGrid的单字段查询
- 查询和下拉框查询,添加,表格
- jqgrid实现多行数据弹出框添加修改查询操作
- Magento Grid collection联表查询添加字段
- 多级控制的主从表查询
- 数据库查询优化(主从表的设计)
- jqGrid查询分析
- jqGrid分页查询出错
- jqgrid 条件查询
- 查询按钮
- 实现jqgrid 行编辑,级联查询,并点击按钮保存
- 主从表外联结查询
- Oracle 主从表联合查询
- 关联子查询
- 在网页中使用Applet的标签
- aaa
- day10/JavaAPI
- 为开源事业贡献了第一份力量
- jqgrid主从表查询+添加grid按钮+查询框的“X”取消+查询框去掉
- lighttpd做缓存的简单配置
- 说说域名、二级域名和主机名的联系区别
- android mmssms.db各个表介绍
- 一些关于游戏开发的需要的教程地址整合
- 指向学生类的指针
- python中的urlencode与urldecode
- 推荐几款常用的开源博客系统
- Android:Canvas