我有输入标签(文本框)和 dxDatagrid。我能够将所有选定的值从 dxDatagrid 传递到数据库,但我也想通过一键单击传递文本框(在网格之外)值。
$("#myButton").dxButton({
text: "Test",
onClick: function () {
var stones = (JSON.stringify(dataGrid.getSelectedRowsData()));
console.log(stones);
updatedetgridReturnShip(stones);
}
});
function updatedetgridReturnShip(stonedetailsarr){
$('#sloader').show();
$.ajax({
url: 'php/insertGridReturnShipment.php',
dataType: 'json',
type: "POST",
data: {
returnstonedetails: stonedetailsarr,
txtRefnoval : txtRefnoval
},
success: function (result) {
alert(result);
$('#sloader').hide();
$("#myImportModal").modal("hide");
}
});
}
PHP服务器端代码:
$StoneArr = json_decode($returnstonedetails, true);
$updstmt = '';
foreach ($StoneArr as $Stone){
$textboxval = $_POST['textboxval'];
$refVal = json_decode($textboxval, true);
$updstmt .= 'CALL return_ship_stones('.'"'.$Stone["carat"].'"'.',
'.'"'.$Stone["clarity"].'"'.','.'"'.$Stone["color"].'"'.','.'"'.$Stone["invcno"].'"'.','.'"'.$Stone["invoicedate"].'"'.', '.'"'.$Stone["lab"].'"'.',
'.'"'.$Stone["measurement"].'"'.' , '.'"'.$Stone["ppt"].'"'.' , '.'"'.$Stone["qstonesid"].'"'.' , '.'"'.$Stone["qty"].'"'.' ,
'.'"'.$Stone["reportno"].'"'.' , '.'"'.$Stone["shape"].'"'.' , '.'"'.$Stone["totalvalue"].'"'.', '.'"'.$refVal["referenceid"].'"'.');';
}
单击一次如何在数据库中同时传递文本框和 dxDatagrid 值