//修改
$("#eventList").on("click",".btn-edit",function () {
var _id = $(this).parent().data("id");
var model_id = $("#resBox").find(".list-modal").find(".actt").data("id");
var _data = {
id: _id,
model_id : model_id
};
ModifyRecord({
title: "编辑记录",
html: __inline("./content/userUpdate.html"),
callback: function(box){
var _box = box.find("#confirm");
$.ajax({
url: api.configfiledetail,
data: {
id : _id,
model_id :model_id,
},
type: 'get',
dataType: 'json',
success: function(data){
data1 = data;
_box.find("." +fie+"+ ").val(data+"."+" + fie + ");
var form = $("#formModel",parent.document);
var html = "";
if(typeof data != "undefined" && data.data.field !==null && data.data.field.length != 0){
var field = data.data.field;
var datalist = data.data.datalist;
// $.each(field,function (i,fie) {
// html += "<div class="form-group" clear><label data-field="+fie+">"+fie+"</label><div class='col-sm-10'><input type='text' class='form-control'>"+datalist[O][fie]+"</div></div>";
//
// });
for (var i = 0; i < field.length; i++) {
var fie = field[i];
var listStr = datalist[fie];
if ("undefined" == typeof(listStr)) {
listStr = "";
}
html += "<div class='form-group forms clear'><label class='control-label' style='margin-top: 10px' data-field=" + fie + ">" + fie + "</label><div class='controls '><input type='text' class='form-control " +fie+ "' data-field=" + fie + " value='" + listStr + "'></div></div>";
}
}
form.append(html);
}
});
},
id: _id,
model_id : model_id,
url: api.modifyconfig
});
$(this).attr('data-target','#confirm');
});
来源:https://www.cnblogs.com/wangkangni/p/7427782.html