jQuery MiniUI
标题:
datarid 行编辑时,根据单下拉框的值,控制单元格可编辑
[打印本页]
作者:
wangqianwq
时间:
2016-8-20 15:05:18
标题:
datarid 行编辑时,根据单下拉框的值,控制单元格可编辑
如何所示,我要根据有害生物的值,来判断是虫害的话,虫口数量单元格允许编辑,病斑数单元格不可编辑
现在我的问题是,我页面加载时,我直接设置虫口数量跟病斑数单元格不可编辑,通过js来控制其允许编辑的时候报错,在 wpmcInput.setEnabled(true);提示Cannot read property 'setEnabled' of undefined,应该怎么表示呢
[attach]7826[/attach]
<div field="PestId" width="100" required="true" type="comboboxcolumn" headeralign="center" align="center">
林业有害生物
<input property="editor" id="PestName" name="PestName" class="mini-combobox" style="width: 100%;" textfield="DictionaryName" valuefield="DictionaryId" emptytext="林业有害生物"
url="../../AjaxService/MES_Ajax.aspx?method=GetPestType" showNullItem="true" />
</div>
<div field="WormNum" vtype="int" width="80" headeralign="center" align="center">
虫口数量
<input property="editor" Enabled="false" name="WormNum" id="WormNum" class="mini-textbox" style="width: 100%;" />
</div>
<div field="LesionTrunkNum" vtype="int" width="90" headeralign="center" align="center">
树干病斑数
<input property="editor" Enabled="false" id="LesionTrunkNum" name="LesionTrunkNum" class="mini-textbox" style="width: 100%;" />
</div>
<div field="LeafDiseasesId" type="comboboxcolumn" autoshowpopup="true" width="120" headeralign="center" align="center">
叶部病害比例
<input property="editor" class="mini-combobox" Enabled="false" id="LeafDiseasesId" name="LeafDiseasesId" style="width: 100%;" textfield="DictionaryName" valuefield="DictionaryId" emptytext="叶部病害比例"
url="../../AjaxService/MES_Ajax.aspx?method=GetProportionOfLeafDiseases" />
</div>
function Pestchanged(e) {
var PestId = mini.getbyName("PestName");
console.log(PestId);
$.ajax({
url: "../../AjaxService/MES_Ajax.aspx?method=GetPestNameType&DictionaryId=" + PestId.value,
cache: false,
success: function (text) {
var o = mini.decode(text);
var PestNameType = o[0].PestType;
//alert(PestNameType);
if (PestNameType == '0') {//虫害
var wpmcInput = mini.getbyName("WormNum");
wpmcInput.setEnabled(true);
alert(2);
var wpmcInput = mini.getbyName("LeafDiseasesId");
wpmcInput.setEnabled(true);
var wpmcInput = mini.getbyName("LesionTrunkNum");
wpmcInput.setEnabled(false);
var wpmcInput = mini.getbyName("BudsNum");
wpmcInput.setEnabled(false);
}
else if (PestNameType == '1') {
var wpmcInput = mini.getbyName("LesionTrunkNum");
wpmcInput.setEnabled(true);
var wpmcInput = mini.getbyName("BudsNum");
wpmcInput.setEnabled(true);
var wpmcInput = mini.getbyName("WormNum");
wpmcInput.setEnabled(false);
var wpmcInput = mini.getbyName("LeafDiseasesId");
wpmcInput.setEnabled(false);
}
}
});
}
作者:
dforce
时间:
2016-8-22 09:24:17
http://www.miniui.com/demo/#src=datagrid/editable.html
请参考可控编辑的示例,在oncellbeginedit事件内处理
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2