我使主网格行可编辑,并且不需要在层次结构网格中编辑行。但问题是,一旦我点击层次结构网格的一行,它就变得可编辑,并且主网格的相同列数的值将是出现在层次结构网格的选定列中。下面的图片更有意义。
正如我所提到的,我不需要在层次结构网格中发生这种情况。
到目前为止,这是我的代码....
$("#allTransGrid").shieldGrid({
dataSource: {
data: datad,
schema: {
fields: {
mbr_id: {path: "mbr_id", type: String},
lon_id: {path: "lon_id", type: String},
center_name: {path: "center_name", type: String},
grp_name: {path: "grp_name", type: String},
mbr_name: {path: "mbr_name", type: String},
lon_amt: {path: "lon_amt", type: Number},
lon_int_amt: {path: "lon_int_amt", type: Number},
loan_total: {path: "loan_total", type: Number},
ind_inst: {path: "ind_inst", type: Number},
today_pay: {path: "today_pay", type: Number, nullable: false},
lon_id_as: {path: "lon_id_as", type: Number}
}
}
},
sorting: {
multiple: true
},
paging: {
pageSize: 12,
pageLinksCount: 10
},
events: {
editorCreating: function (e) {
if (e.field == "ind_inst") {
e.options = {enabled: false, max: 1000};
}
if (e.field == "loan_total") {
e.options = {enabled: false, max: 500000};
}
if (e.field == "lon_int_amt") {
e.options = {enabled: false, max: 100000};
}
if (e.field == "lon_amt") {
e.options = {enabled: false, max: 100000};
}
if (e.field == "mbr_name") {
e.options = {enabled: false};
}
if (e.field == "grp_name") {
e.options = {enabled: false};
}
if (e.field == "center_name") {
e.options = {enabled: false};
}
if (e.field == "lon_id") {
e.options = {enabled: false};
}
if (e.field == "mbr_id") {
e.options = {enabled: false};
}
if (e.field == "today_pay") {
e.options = {max: 10000};
console.log(e.options);
}
},
detailCreated: function (e) {
$.ajax({
url: "PaymentCatcherGroupBy",
cache: false,
dataType: 'JSON',
data: {loan_id: e.item.lon_id_as, c_id: center_id},
success: function (data) {
$("<div/>")
.appendTo(e.detailCell)
.shieldGrid({
dataSource: {data: data},
sorting: {
multiple: true
},
paging: {
pageSize: 5
},
columns: [
{field: "installment_num", title: "Week"},
{field: "installmentAmount", title: "Installment Amount"},
{field: "paidAmount", title: "Paid Amount"},
{field: "dueDate", title: "Date Paid", type: Date}
],
events: {
editorCreating: function (e) {
if (e.field == "installment_num") {
e.options = {enable: false};
}
}
}
});
}, error: function (jqXHR, textStatus, errorThrown) {
alert('error');
}
});
}
},
selection: {
type: "row",
multiple: true,
toggle: false
},
columns: [
{field: "mbr_id", width: "100px", title: "Member ID", enabled: false},
{field: "lon_id", width: "100px", title: "Loan ID"},
{field: "center_name", title: "Center Name", width: "100px"},
{field: "grp_name", title: "Group Name", width: "70px"},
{field: "mbr_name", title: "Member Name", width: "170px"},
{field: "lon_amt", title: "Loan Amount", width: "100px"},
{field: "lon_int_amt", title: "Interest", width: "100px"},
{field: "loan_total", title: "Total", width: "80px"},
{field: "ind_inst", title: "Installment Amount", width: "120px"},
{field: "today_pay", title: "Today Payment"}
],
editing: {
enabled: true,
event: "click",
type: "cell"
},
scrolling: true,
height: 600
});
任何帮助都会很明显。谢谢!
答案 0 :(得分:3)
您可以禁用详细网格的编辑:
https://www.shieldui.com/documentation/grid/javascript/api/settings/editing
或者您可以将editable设置为false以表示您不想编辑的列。
列:[ {field:“mbr_id”,width:“100px”,title:“会员ID”,可编辑:false},
我希望这可以解决你的问题。