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.
Hi Nikolay,
Thanks for the help. Before I changed the existing code, I used another button, with GridColumn. I used template there,
Please see the posting below:
http://ko.infragistics.com/community/forums/t/89554.aspx
The $i is not getting incremented for each row, it is always zero. If I can get it increasing, then I can move to template column.
Hello,
I'd suggest you to use column template: http://help.infragistics.com/Help/Doc/jQuery/2014.1/CLR4.0/html/Creating%20a%20Basic%20Column%20Template%20in%20the%20igGrid.html
Here is an example: http://www.igniteui.com/grid/column-template
Let me know if you have any questions.
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.