Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
disable button in a column depending on the Status of a check box in another column
posted

Hi,

I am using MVC igHierarchicalGrid v2014.1, I want to enable and disable the button in one of the column in the grid depending upon the status of another column.

Eg:

Controller Code :  grid.Columns.Add(new UnboundColumn { HeaderText = "Begin Signing",Key = "Start",DataType = "string",Width = "10%",FormatterFunction = SetSignStatus(" + $(SignatureStatus) + " )});

grid.Columns.Add(new GridColumn() { HeaderText = "Status",Key = "SignatureStatus",DataType = "bool",Width = "5%",Format = "checkbox" });

As you see, I want to disable the button depending on the Status key.
private static string SetSignStatus(string signerStatus)
      {
          var sb = new StringBuilder();
          sb.Append(" function(obj){");
          sb.Append(" if (obj.SignatureStatus){return '<input type= button   value=Start />';}");
          sb.Append(" else if  (!obj.SignatureStatus){ return '<input type=button  disabled=disabled value=Start />';} ");
          sb.Append("} ");
          return sb.ToString();
      }
Unfortunately, I am not understanding the way I can send the "row" so that I can check something like row.SignatureStatus or just the SignatureStatus.
Also if you observe I am using FormatterFunction = SetSignStatus(" + $(SignatureStatus) + " )},
this syntax is not working, the parameter in SetSignStatus(string signerStatus) is return a value as "$(SignatureStatus)".

Your help is much appreciated.