【发布时间】:2015-10-08 16:42:12
【问题描述】:
我需要根据同一行前一列中的值禁用或启用该行的最后一列。我们使用 Datatables 来创建表格。
在使用mRender 渲染数据进行比较时,我无法获取行的单元格中存在的值。任何人都可以帮助获取mRender 中的行的值吗?
我尝试使用iDataRow 以及createdRow 和fnRowCallback 在创建表后禁用最后一列。
我不知道为什么createdRow 在aoColumns 中不起作用。
请在下面找到我的代码 sn-p:
"aoColumns": [{
"mData": "productID",
"bSearchable": true,
"bSortable": true
}, {
"mData": "barcode",
"bSearchable": true,
"bSortable": true
}, {
"mData": "fulfillmentChannel",
"bSearchable": true,
"bSortable": true
}, {
"mData": "dateAvailable",
"bSearchable": true,
"bSortable": true
}, {
"mData": "stockStatus",
"bSearchable": true,
"bSortable": true
}, {
"mData": "stockAllocation",
"mRender": function (data, type, full, iDataRow) {
console.log(iDataRow);
<c:if test="${User.permission eq 'All'}">
return '<input type="text" class="form-control" style="width:100%" id="stockAllocation" validationDescription="<spring:message code="validation.mustBeDigit"></spring:message>" validationRules="^[0-9]+$" name="stockAllocation" value="' + data + '"></input>';
</c:if>
<c:if test="${User.permission eq 'ReadOnly'}">
return data;
</c:if >
},
"bSearchable": true,
"bSortable": true
}],
我想将fullfillmentchannell 和stockAllocation 的值写入mRender 写入条件并禁用stockAllocaton 字段。
【问题讨论】:
标签: javascript jquery datatables