require_once '../jq-config.php';
$grid = new jqGridRender($conn);
$table = 'DIVISI';
$_REQUEST['filters'] = strtoupper($_REQUEST['filters']);
$grid->SelectCommand ='SELECT DIVISIID, GROUPS, DIVISI FROM '.$table;
$grid->dataType = 'json';
$grid->setPrimaryKeyId("DIVISIID");
$grid->setColModel();
$grid->table = $table;
$grid->setColProperty("DIVISIID", array("label"=>"ID", "hidden"=>true));
$grid->setColProperty("GROUPS", array("label"=>"Groups","width"=>30, "editoptions"=>array("style"=>"text-transform: uppercase;")
,"searchoptions"=>array("sopt"=>array("cn"), "style"=>"text-transform: uppercase;")));
$grid->setColProperty("DIVISI", array(
"label"=>"Divisi",
"width"=>90,
"editoptions"=>array("style"=>"text-transform: uppercase;"),
"searchoptions"=>array("sopt"=>array("cn"), "style"=>"text-transform: uppercase;" )
));
$grid->setUrl('divisi_.php');
$grid->setGridOptions(array("rowNum"=>99999,"rowList"=>array(10,20,30),"sortname"=>"DIVISI", "width"=>"500"));
$grid->toolbarfilter = true;
$grid->navigator = true;
$grid->setNavOptions('navigator', array("excel"=>true,"add"=>true,"edit"=>true,"del"=>true,"view"=>true));
$grid->setFilterOptions(array("stringResult"=>true,"searchOperators"=>true,"searchOnEnter"=>true,"defaultSearch"=>"cn","ignoreCase"=>true));
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$oper = $_POST['oper'];
if($oper == 'add') {
$grid->table = 'DIVISI';
$grid->setPrimaryKeyId('DIVISIID');
$data = array_map("strtoupper", $_POST);
$grid->insert($data);
} else if($oper == 'edit') {
$grid->table = 'DIVISI';
$grid->setPrimaryKeyId('DIVISIID');
$data = array_map("strtoupper", $_POST);
//array_map("strtoupper", $sample_array);
$grid->update($data);
} else {
$grid->setUrl('divisi_.php');
}