I want to save it directly when I click on the tick after editing the cell. Could you tell me how to change it?
Baidu"s use of onEditableSave didn"t work either.
<td class="role_edit" data-type="checklist" id="role_edit_1">
<span class="label label-success" role_id="1"></span>
<span class="label label-success" role_id="2">2</span>
</td>
-------------------------------------------------------------
//
$(".role_edit").on("click",function () {
var id_arr = new Array();
var me = $(this);
var rid = me.attr("id");
me.children().each(function () {
id_arr.push($(this).attr("role_id"));
});
//
$.ajax({
url: "/system/editUserRole",
type:"post",
dataType: "json",
data: {
role_id:id_arr
},
headers : {
"X-CSRF-TOKEN": $("input[name="_token"]").val()
},
success:function (response) {
var response = response
$("-sharp"+rid).editable({
placement:"right",
field: "rid",
value: id_arr,
source: response,
method : "post",
// onEditableSave
onEditableSave: function (field, row, oldValue, $el) {//
$.ajax({
type: "POST",
url: "/system/doedituserrole",
data: row,
dataType: "json",
cache: false,
success: function (data) {
console.log("")
error: function () {
},
complete: function () {
}
});
}
})
}
}).fail(function(response) {
if(response.status == 422){
var data = $.parseJSON(response.responseText);
var layerStr = "";
for(var i in data.errors){
layerStr += data.errors[i]+" ";
}
sweetAlert("", layerStr);
}else{
sweetAlert("", "");
}
});
});