Title: edataGrid onSuccess not firing
Post by: pato.llaguno on April 10, 2016, 12:17:30 PM
hello, im using a normal datagrid with detailview, and when this expands a row it will get a subdatagrid, this subdatagrid is where the edatagrid is used, i need to be able to edit 1 value from the row, and i am able to do this correctly, but for some reason the on Success event is never triggering. onError is triggering fine though. here is how im creating the edatagrid. $('#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"); } });and my updateURL <?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; } ?>
|