【问题标题】:jeasyui Editable datagrid not firing event onSuccessjeasyui 可编辑数据网格未触发事件 onSuccess
【发布时间】:2016-07-31 18:43:28
【问题描述】:

editable grid documentation

detailview documentation

我使用带有详细视图的普通数据网格,当它展开一行时,它将得到一个子数据网格,这个子数据网格是使用 edatagrid 的地方,我需要能够从行中编辑 1 个值,并且我能够正确执行此操作,但由于某种原因,on Success 事件永远不会触发。虽然 onError 触发良好。

关于为什么不触发 onSuccess 有什么建议吗?

这是我创建 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");
}
});

还有我的 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;
}
?>

【问题讨论】:

    标签: jquery datagrid jquery-easyui


    【解决方案1】:

    我遇到了转储错误,因为回显的 json 数组是 $Id 而不是 $id,因为它不会触发成功事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-13
      • 1970-01-01
      • 2014-12-09
      • 2012-12-20
      • 1970-01-01
      • 2011-10-07
      • 2021-10-21
      • 2016-07-10
      相关资源
      最近更新 更多