Page 1 of 1

Unset "required" field inside grid

Posted: Thu Aug 01, 2019 8:10 am
by Zora99
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);
      }
    }
}

Re: Unset "required" field inside grid

Posted: Fri Aug 02, 2019 12:42 am
by amosbatto
If you are asking how to remove the "required" property from a grid field, see this example:
https://www.pmusers.com/index.php/Enabl ... grid_field

Is that your question?