I’ve found it using js…
But… maybe you can cange setAutocomplete with multi product… just maybe…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
.... $grid->setColProperty("PRODUCTID", array("label"=>"PRODUCTID", "hidden"=>true )); // autocomplete javascript code $prod = <<<CUSTOM function (elem) { $(elem).autocomplete({ source: "../lookup/loProduct.php", select: function(event, ui) { $("#PRODUCTID").val(ui.item.PRODUCTID); $("#PRICE").val(ui.item.PRICE); } }); jQuery('.ui-autocomplete').css({'zIndex':'1200','font-size':'75%'}); } CUSTOM; // attaching the autocomplete function $grid->setColProperty('PRODUCT',array("editoptions"=>array("dataInit"=>"js:".$prod))); |
Hi,
Thanks… It works… your update not include jquery.js .. I forgot to update to jquery.min.js …
Hi,
It’s working by adding math function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$calcs = <<< CALCS function(postdata) { postdata['SALARY'] = math.eval(postdata['SALARY']); return postdata; } CALCS; $grid->setNavEvent("edit", "serializeEditData", $calcs); $grid->setNavEvent("insert", "serializeEditData", $calcs); |
okay… thank you…
But I think I will change any formatter number with this math function… I’m the lazy one… LOL…
Thank you for your support
Hi,
Maybe you can see my demo using jqGrid PHP and jqSuite PHP… I love jqSuite cause it cut my production time a lot. There’s nothing special coding both of them.
jqgrid code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
$karyawanid = $_POST['KARYAWANID']; if (empty($karyawanid)&& $karyawanid!= 0) {$karyawanid = 'null'; } $tgl = "'$_POST[TGL]'"; if (empty($_POST[TGL])) {$tgl = 'null'; } $desc = $_POST['DESC']; if (empty($desc)&& $desc!= 0) {$desc = 'null'; } $salary = $_POST['SALARY']; if (empty($salary)) {$salary = 'null'; } $action = $_REQUEST['oper']; if( $_REQUEST['export']=='excel') $action = 'export'; if (empty($action) && empty($_POST['id'])) {$action = 'load';} else if (empty($action)) {$action = 'edit'; } $pos = strpos($wh, "TGL"); if ($action=='del') { $sql = "Delete from COBA where KARYAWANID = ".$id; $stmt = $connPDO->query($sql); if(!$stmt){$error = $connPDO->errorInfo(); $_SESSION[message]=$error[2];} } else if ($action == 'add') { $sql = "Insert into COBA (KARYAWANID, TGL, DESC, SALARY) values ($id, $tgl, $desc, $salary)"; $stmt = $connPDO->query($sql); if(!$stmt){$error = $connPDO->errorInfo(); $_SESSION[message]=$error[2];} } else if ($action == 'edit') { $sql = "update COBA set tgl = $tgl ,salary = $salary where KARYAWANID = $id"; $stmt = $connPDO->query($sql); if(!$stmt){$error = $connPDO->errorInfo(); $_SESSION[message]=$error[2];} } else if ($action=='load') { $i=0; $sql = "select k.nama, c.tgl, c.karyawanid, c.desc, c.salary from coba c left join karyawan k on c.karyawanid = k.karyawanid where 1=1 $wh order by $sidx $sord" ; $_SESSION['sqlKaryawan'] = $sql; $stmt = $connPDO->query($sql); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $i=0; foreach ($rows as $row) { $responce->rows[$i]['id']=$row[KARYAWANID]; $responce->rows[$i]['cell']=array($row[NAMA], $row[TGL] ,$row[DESC], $row[SALARY] ,$row[KARYAWANID]); $i++; } if($_SESSION[message]) {$responce->userdata['message'] = $_SESSION[message];unset($_SESSION['message']);} echo json_encode($responce); |
jqSuite PHP code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
..... $grid->dataType = 'json'; $grid->setPrimaryKeyId("COBAID"); $grid->setColModel(); $grid->table = $table; $grid->setUrl('coba2_.php'); $grid->setDbTime('Y-m-d'); $grid->setDbDate('Y-m-d'); $grid->setUserDate('Y-m-d'); $grid->setUserTime('Y-m-d'); $grid->setColProperty("COBAID", array("label"=>"ID", "hidden"=>true)); $grid->setColProperty('TGL', array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "Y-m-d"), "editoptions" => array("dataInit" => "js:function(elm){ jQuery(elm).datepicker({dateFormat:'yy-m-d'}); jQuery('.ui-datepicker').css({'zIndex':'1200','font-size':'75%'});}") )); $grid->setColProperty("KARYAWANID", array("label"=>"KaryawanId (should be hidden)","hidden"=>true, "editable"=>true, "searchoptions"=>array("sopt"=>array('cn')))); $grid->setColProperty("NAMA", array("label"=>"Name", "searchoptions"=>array("sopt"=>array('cn')))); $grid->setAutocomplete("NAMA","#KARYAWANID","SELECT kk.NAMA, kk.NAMA, kk.KARYAWANID FROM KARYAWAN kk WHERE NAMA LIKE upper(?)" . " ORDER BY kk.NAMA ",null, true, true); $grid->setColProperty("DESC", array("label"=>"Description", "width"=>85, "searchoptions"=>array("sopt"=>array('cn')))); $grid->setColProperty("SALARY", array("label"=>"Salary","formatter"=>"number", "summaryType"=>"sum", "align"=>"right","search"=>false, "width"=>85,"searchoptions"=>array("sopt"=>array("eq","gt","lt")))); $grid->setGridOptions(array("rowNum"=>99999,"rowList"=>array(10,20,30),"sortname"=>"TGL", "height"=>'150', "caption"=>"Date on First Column (popup not shown)", "footerrow"=>true, "userDataOnFooter"=>true, "grouping"=>false, "shrinkToFit"=>false, "width"=>600 )); $grid->ignoreCaseSearch = true; $grid->setSearchOptions( array ( "sqlfunc" => "UPPER", "phpfunc" => "strtoupper" )); $grid->toolbarfilter = true; $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>false,"add"=>true,"edit"=>true,"del"=>true,"view"=>true)); $_POST = array_map("strtoupper", $_POST); $grid->renderGrid('#grid2','#pager2',true, null, null, true,true); |
I’ve tried to entry both :
would be loved to if it can be done with jqSuite PHP.
Regards,
Ari Adrianto
Hi,
I’ve found temporary solution… do not put autocomplete in first field. And everything will works fine.
Thanks.
Hi,
I’m still waiting solution for number 3 issue. Actually, it’s not happen when edit with inline Edit. This is what I did on all my grid when there’s autocomplete field on it, to solve the problem for while.
Best Regards,
Hi,
2. solved … I just delete settimeout… It works… even without showOn : focus
1 2 3 4 5 6 7 8 9 10 11 12 |
..... $grid->setColProperty('TGL', array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "Y-m-d"), "editoptions" => array("dataInit" => "js:function(elm){ jQuery(elm).datepicker({dateFormat:'yy-m-d'}); jQuery('.ui-datepicker').css({'zIndex':'1200','font-size':'75%'});}") )); ..... |
Thanks
Hi ,
Thanks for your quick response.
3. source :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
$grid = new jqGridRender($conn); $table = 'COBA'; $grid->SelectCommand ="select k.nama, c.tgl, c.karyawanid, c.desc from coba c left join karyawan k on c.karyawanid = k.karyawanid "; $grid->dataType = 'json'; $grid->setPrimaryKeyId("COBAID"); $grid->setColModel(); $grid->table = $table; $grid->setUrl('coba3_.php'); $grid->setDbTime('Y-m-d'); $grid->setDbDate('Y-m-d'); $grid->setUserDate('Y-m-d'); $grid->setUserTime('Y-m-d'); $grid->setColProperty("COBAID", array("label"=>"ID", "hidden"=>true)); $grid->setColProperty('TGL', array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "Y-m-d"), "editoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){ jQuery(elm).datepicker({dateFormat:'yy-m-d', showOn : 'focus'}); jQuery('.ui-datepicker').css({'zIndex':'1200','font-size':'75%'});},100);}") )); $grid->setColProperty("KARYAWANID", array("label"=>"KaryawanId (should be hidden)","hidden"=>false, "editable"=>true, "searchoptions"=>array("sopt"=>array('cn')))); $grid->setColProperty("NAMA", array("label"=>"Name", "searchoptions"=>array("sopt"=>array('cn')))); $grid->setAutocomplete("NAMA","#KARYAWANID","SELECT kk.NAMA, kk.NAMA, kk.KARYAWANID FROM KARYAWAN kk WHERE NAMA LIKE upper(?)" . " ORDER BY kk.NAMA ",null, true, true); $grid->setColProperty("DESC", array("label"=>"Description", "width"=>85, "searchoptions"=>array("sopt"=>array('cn')))); $grid->setGridOptions(array("rowNum"=>99999,"rowList"=>array(10,20,30),"sortname"=>"TGL", "height"=>'150', "caption"=>"AutoComplete Column on first", "footerrow"=>true, "userDataOnFooter"=>true, "grouping"=>false, "shrinkToFit"=>false, "width"=>600 )); // Enable toolbar searching $grid->ignoreCaseSearch = true; $grid->setSearchOptions( array ( "sqlfunc" => "UPPER", "phpfunc" => "strtoupper" )); $grid->toolbarfilter = true; $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>false,"add"=>true,"edit"=>true,"del"=>true,"view"=>true)); $_POST = array_map("strtoupper", $_POST); $grid->renderGrid('#grid3','#pager3',true, null, null, true,true); |
2. just like number 3… but modify on sql command :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
............. $grid->SelectCommand ="select c.tgl, c.karyawanid, k.nama, c.desc from coba c left join karyawan k on c.karyawanid = k.karyawanid "; ............ $grid->setColProperty('TGL', array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "Y-m-d"), "editoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){ jQuery(elm).datepicker({dateFormat:'yy-m-d', showOn : 'focus'}); jQuery('.ui-datepicker').css({'zIndex':'1200','font-size':'75%'});},100);}") )); ............ |
Already added “showOn : ‘focus’ ” but nothing shown up.
Already update this link.
Thanks
Hi ,
Thanks… it works…
But I think it’s not wise to change “enter” key with submit, it will destroy autocomplete, select, calendar.
I change ascii 120 for F9 or any other key besides “enter”. Here is My demo.
Hello,
I’ve made a demonstration of this…
http://multidayacipta.com/demos/hrd/info/coba.php
Thank you very much…
Is there any other option that user doesn’t need to use mouse on submit ?
Maybe shortcut key on submit button ?
Thank you..
sorry.. my mistaken…
I should delete this row :
sar = jQuery(‘#grid’).jqGrid(‘getGridParam’,’selarrrow’);
Hi,
Thanks for the answer…
I don’t know why, but it’s not working … I modify like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$selectorder = <<<ORDER function(rowid, selected) { if(rowid != null) { var gridrow = jQuery("#grid").jqGrid('getRowData',rowid); sar = jQuery('#grid').jqGrid('getGridParam','selarrrow'); totFreight += parseFloat(gridrow.Freight); var pdata=[]; pdata['Freight'] = totFreight; if(!isNaN(pdata['Freight'])){ $(this).jqGrid('footerData', 'set', pdata, true); } } } ORDER; $grid->setGridEvent('onSelectRow', $selectorder); |
It’s working now. But Thank you very much…
Ari
Thanks,
It’s all working now…
I’ve found solution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$onselrow = <<< ONSELROW function(rowid, selected) { if(rowid && rowid !== lastSelection) { $("#detail").jqGrid('restoreRow', lastSelection); $("#edit_detail").trigger("click"); lastSelection = rowid; } } ONSELROW; $grid->setGridEvent('onSelectRow', $onselrow); |
It works now… thanks…
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top