editable grid documentationjeasyui Düzenlenebilir datagrid DetailView ile normal veri kılavuzunu kullanarak
im onSuccess olay ateş değil ve bu bir satır genişlediğinde bir subdatagrid alacak, bu subdatagrid i ise Satırdan 1 değeri düzenleyebilmeli ve bunu doğru bir şekilde yapabilmem gerekir, ancak bazı nedenlerle Başarı olayında hiçbir zaman tetiklenmez. onError iyi olsa da tetikliyor.
onSuccess neden tetiklenmediğine dair herhangi bir öneriniz var mı? Edatagrid'i nasıl oluşturduğum aşağıda anlatılmaktadır.
$('#ddv2-'+index).edatagrid({
url:'getOrderDetailProvision.php?id='+row.Id,
updateUrl: 'update_sim.php',
fitColumns:true,
singleSelect:true,
rownumbers:true,
height:'auto',
autoSave:true,
columns:[[
{field:'Serie',title:'Serie',width:40},
{field:'UniqueId',title:'Unique ID', width:40},
{field:'AVL',title:'AVL ID', width:40},
{field:'sim',title:'Sim', width:40,editor:'textbox'},
{field:'Numero',title:'Numero Telefonico',width:40},
{field:'Producto',title:'Producto',width:40}
]],
onError: function(index2,row2){
console.log("onError");
console.log(row2);
},
onSave: function(index3,row3){
console.log("onSave");
console.log(row3);
},
onSuccess:function(index4,row4){
console.log("onSuccess");
console.log(row4.msg);
},
onEdit:function(index5,row5){
console.log("onEdit");
}
});
ve benim updateURL 'update_sim.php'
<?php
include "includes/db_config.php";
include "ChromePhp.php";
$post = getRealPOST();
ChromePHP::log("Array : ", $post);
$id = intval($post['Id']);
$Serie = $post['Serie'];
$Producto = $post['Producto'];
$AVL = $post['AVL'];
$UniqueId = $post['UniqueId'];
$sim = $post['sim'];
$conn = sqlsrv_connect(SV_NAME, $connectionInfo) OR die("Unable to connect to the database");
$sql = "SELECT Id,Numero from Lineas WHERE Sim= $sim";
$params = array();
$options = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
$result = array();
$res = sqlsrv_query($conn, $sql, $params, $options);
if(sqlsrv_num_rows($res) == 0){
echo json_encode(array(
'isError' => true,
'msg' => 'No existe SIM en BD'
));
ChromePHP::log("Error no rows");
ChromePHP::log($sql);
}else if(sqlsrv_num_rows > 1){
ChromePHP::log("Error no rows");
echo json_encode(array(
'isError' => true,
'msg' => 'Multiples SIM en BD'
));
}else{
$row = sqlsrv_fetch_array($res, SQLSRV_FETCH_ASSOC);
$telefono = $row['Numero'];
$sql = "UPDATE producto SET Sim_Id=(SELECT Id from Lineas WHERE Sim= $sim) WHERE Id = $id";
$res = sqlsrv_query($conn, $sql, $params, $options);
echo json_encode(array(
'isSuccess' => true,
'Id' => $Id,
'Serie' => $Serie,
'UniqueId' => $UniqueId,
'AVL' => $AVL,
'Producto' => $Producto,
'sim' => $sim,
'Numero' => $telefono
));
ChromePHP::log($sql);
}
function getRealPOST() {
$pairs = explode("&", file_get_contents("php://input"));
$vars = array();
foreach ($pairs as $pair) {
$nv = explode("=", $pair);
$name = urldecode($nv[0]);
$value = urldecode($nv[1]);
$vars[$name] = $value;
}
return $vars;
}
?>