- Thu Aug 01, 2019 8:10 am
#825731
How to unset required field inside a grid based on dropdown value?
Code: Select all
function set_jenis_dokumen(){
var aGridVals = $('#allItem').getValue();
//loop through grid
for (var i = 1; i <= aGridVals.length; i++) {
var jenis_dokumen = $("#allItem").getValue(i, 25);
if(jenis_dokumen == 4){
$("#allItem").getControl(i, 26).showColumn();
$("#allItem").getControl(i, 27).showColumn();
$("#allItem").getControl(i, 28).hideColumn();
$("#allItem").getControl(i, 26).attr("disabled", false);
$("#allItem").getControl(i, 27).attr("disabled", false);
$("#allItem").getControl(i, 28).attr("disabled", true);
}else if(jenis_dokumen == 3){
$("#allItem").getControl(i, 26).showColumn();
$("#allItem").getControl(i, 27).showColumn();
$("#allItem").getControl(i, 28).hideColumn();
$("#allItem").getControl(i, 26).attr("disabled", false);
$("#allItem").getControl(i, 27).attr("disabled", false);
$("#allItem").getControl(i, 28).attr("disabled", true);
}
else if(jenis_dokumen == 2){
$("#allItem").getControl(i, 26).showColumn();
$("#allItem").getControl(i, 27).showColumn();
$("#allItem").getControl(i, 28).showColumn();
$("#allItem").getControl(i, 26).attr("disabled", false);
$("#allItem").getControl(i, 27).attr("disabled", false);
$("#allItem").getControl(i, 28).attr("disabled", false);
}
else if(jenis_dokumen == 1){
$("#allItem").getControl(i, 26).hideColumn();
$("#allItem").getControl(i, 27).hideColumn();
$("#allItem").getControl(i, 28).hideColumn();
$("#allItem").getControl(i, 26).attr("disabled", true);
$("#allItem").getControl(i, 27).attr("disabled", true);
$("#allItem").getControl(i, 28).attr("disabled", true);
}
}
}