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
Radiabutton list in igHirerachicalgrid
posted

Hi, How can introduce the radio button list in igHirerachicalgrid.

I did achieve it by template column but they do not work as all the buttons in the rows have same name and id. So is there a way to do so that they have different group name for each row and id's?

My sample code:

eSignaturegroup.Group.Add(new GridColumn() { Rowspan=2 , HeaderText = "In Person",Key = "eSign",DataType = "bool",Width = "10%",FormatterFunction = GetESign("InPerson") });
eSignaturegroup.Group.Add(new GridColumn() { HeaderText = "Remote",Key = "eSign",DataType = "bool",Width = "10%",FormatterFunction = GetESign("Remote") });
 
private  string GetESign(string eSign)
       {
        
          
           var sb = new StringBuilder();
           sb.Append(" function(obj){");
          if (eSign.Equals("InPerson"))
           {
               sb.Append(" if (obj == 0 ){return ' <ul class=radio-group> <li><input id=InPerson_" + i + " name=esign_" + i + " type=radio checked=checked /> <label for=InPerson_" + i + "><span><span></span></span></label></li></ul>';}");
               sb.Append(" if (obj == 1 ){return '<ul class=radio-group> <li><input id=InPerson_" + i + " name=esign_" + i + " type=radio   /><label for=InPerson_" + i + "><span><span></span></span></label></li></ul>';}");
              
           }
           else if (eSign.Equals("Remote"))
           {
               sb.Append(" if  (obj == 1 ){ return '<ul class=radio-group> <li><input id=Remote_" + i + "  name=esign_" + i + "  type=radio checked=checked /><label for=Remote_" + i + "><span><span></span></span></label></li></ul>';} ");
               sb.Append(" if (obj == 0 ){return '<ul class=radio-group> <li><input id=Remote_" + i + "  name=esign_" + i + " type=radio  /><label for=Remote_" + i + "><span><span></span></span></label></li></ul>';}");               
           };
         sb.Append("} ");
          
           return sb.ToString();
 
is there a way where I can send the row index so that it can work. Also how can I send the row index in this context?
Your help is much appreciated.
Parents
  • 495
    Verified Answer
    posted

    Hi,

    I achieved it by doing in the following way:

    in Javascript:

    var _counter = 0;

    Controller:
    eSignaturegroup.Group.Add(new GridColumn() { Rowspan=2 , HeaderText = "In Person   Remote",Key = "eSign",DataType = "bool",Width = "10%",FormatterFunction = GetESign("InPerson") });         
    eSignaturegroup.Group.Add(new GridColumn() { HeaderText = "Remote",Key = "eSign",DataType = "bool",Width = "10%",FormatterFunction = GetESign("Remote") });
       private  string GetESign(string eSign)         {             var sb = new StringBuilder();             sb.Append(" function(obj){");             if (eSign.Equals("InPerson"))             {                 sb.Append(" if (obj == 0 ){return ' <ul class="radio-group"> <li><input id=\"InPerson_' + _counter + '\" name=\"esign_' + _counter + '\" type=radio checked=checked /> <label for=\"InPerson_' + _counter + '\"><span><span></span></span></label></li></ul>';}");                 sb.Append(" if (obj == 1 ){return '<ul class="radio-group"> <li><input id=\"InPerson_' + _counter + '\" name=\"esign_' + _counter + '\" type=radio   /><label for=\"InPerson_' + _counter + '\"><span><span></span></span></label></li></ul>';}");             }             else if (eSign.Equals("Remote"))             {                   sb.Append(" if  (obj == 1 ){ ");                 sb.Append(" var str = '<ul class="radio-group"> <li><input id=\"Remote_' + _counter + '\"  name=\"esign_' + _counter + '\"  type=radio checked=checked /><label for=\"Remote_' + _counter  + '\"><span><span></span></span></label></li></ul>';");                 sb.Append("_counter = _counter + 1; console.log('_counter = ' + _counter);");                 sb.Append(" return str; }");                 sb.Append(" if  (obj == 0 ){ ");                 sb.Append(" var str = '<ul class="radio-group"> <li><input id=\"Remote_' + _counter + '\"  name=\"esign_' + _counter + '\"  type=radio /><label for=\"Remote_' + _counter  + '\"><span><span></span></span></label></li></ul>';");                 sb.Append("_counter = _counter + 1; console.log('_counter = ' + _counter);");                 sb.Append(" return str; }");             };             sb.Append("} ");                        return sb.ToString();         }
    
    

    I don't thing I should fight so much to do this kind of task, I guess there should be some kind of setting on the grid to render it with unique names and id's.

    Please do let me know if you have a sample or ref me to the documentation.

    GetESign.zip
Reply Children