I have a class which is populated like this
var Signer2 = new SignerInformation() { SignerIndex = 2, SignerName = "Rob", SignatureStatus = false, eSign = SignerInformation.eSignature.Remote, SignerAuth = new SignerAuthentication { AuthenticationMode = SignerAuthentication.AuthenticationType.Password ,EmailAddress = "tes2t@immonline.com" ,Details = "Signer2 Details" } }; var SignersInfoCol = new List<SignerInformation>(); SignersInfoCol.Add(Signer2); return SignersInfoCol.AsQueryable();
My Hierarchical grid columns are defined like this below:
grid.AutoGenerateLayouts = false; grid.AutoGenerateColumns = false; grid.PrimaryKey = "SignerIndex"; grid.Width = "100%"; grid.Columns.Add(new GridColumn() { HeaderText = "Signer Index",Key = "SignerIndex",DataType = "number",Width = "10%", Hidden=true}); grid.Columns.Add(new GridColumn() { HeaderText = "Signer Name",Key = "SignerName",DataType = "string",Width = "10%" }); grid.Columns.Add(new GridColumn() { HeaderText = "Status",Key = "SignatureStatus",DataType = "string",Width = "10%" }); grid.Columns.Add(new GridColumn() { HeaderText = "Signer Information",Key = "eSign",DataType = "string",Width = "10%" }); grid.Columns.Add(new GridColumn() { HeaderText = "Authentication Mode",Key = "SignerAuth.AuthenticationMode",DataType = "string",Width = "10%" }); grid.Columns.Add(new GridColumn() { HeaderText = "EmailAddress",Key = "SignerAuth.EmailAddress",DataType = "string",Width = "10%" }); grid.Columns.Add(new GridColumn() { HeaderText = "Details",Key = "SignerAuth.Details",DataType = "string",Width = "20%" });
1) So How can I set the complex property?
2) How to format the Status to radio button in control code? and set its status?
You help is much appreciated.
Hello,
Thank you for posting in our forum.
In this case you have to set the columnLayout for the child grid, which will set up the relation between your parent and child class. Please look at this article for detailed information on how to set columns and layouts: http://help.infragistics.com/Doc/jQuery/2013.2/CLR4.0?page=igHierarchicalGrid_Columns_and_Layouts.html
Also, this sample can be helpful: http://igniteui.com/hierarchical-grid/editing-dataset
If you have any questions regarding the matter, please let me know.
Thanks Nikolay,
I could figure it out how to render the checkbox:
2 steps:
1) set grid.RenderCheckboxes = true; 2) set the prop of the column to DataType = "bool".
I still have to figure it out how to set the complex property in the grid.
Another thing you have me 2013 ref, I am using 2014.1,
I am checking 2014.1 documentation.
Hi Nikolay,
No issues, I figured it out by referring the documentation and other examples and used Template and FormatterFunction technique and moved forward.
I was referring to a class which has a property and that property will have some more sub properties. Hope you understood now. Do let me know if there is any other way.
For each sub-property you have to define a columnLayout in your igHierarchicalGrid and set the relationship between them: http://help.infragistics.com/Help/Doc/jQuery/2014.1/CLR4.0/html/igHierarchicalGrid_Columns_and_Layouts.html#layouts
Let me know if you have any further questions.
I'm following up to see if you have any other questions or concerns.
Please see my comments below:
I have a class
var Signer2 = new SignerInformation() {
SignerIndex = 2,
SignerName = "Rob",
SignatureStatus = false,
eSign = SignerInformation.eSignature.Remote,
SignerAuth = new SignerAuthentication {
AuthenticationMode = SignerAuthentication.AuthenticationType.KBA,
EmailAddress = "tes2t@immonline.com",
Details = "Signer2 Details" }
};
In the Hierarchical Grid I used it like this, ofcourse I had to group the below 3 columns, hence you see Group collection.
authenMode.Group.Add(new GridColumn() { HeaderText = "Type",Key = "SignerAuth",DataType = "string",Width = "15%",FormatterFunction = GetAuthiticationMode() }); authenMode.Group.Add(new GridColumn() { HeaderText = "Email Address",Key = "SignerAuth",Template = "${SignerAuth.EmailAddress}",DataType = "string",Width = "15%" }); authenMode.Group.Add(new GridColumn() { HeaderText = "Details",Key = "SignerAuth",Template = "${SignerAuth.Details}",DataType = "string",Width = "15%" }); grid.Columns.Add(authenMode);
private static string GetAuthiticationMode() { var sb = new StringBuilder(); sb.Append(" function(obj){"); sb.Append(" if (obj.AuthenticationMode == 0 ){return 'Email';}"); sb.Append(" else if (obj.AuthenticationMode == 1 ){ return 'Password';} "); sb.Append(" else if (obj.AuthenticationMode == 2 ){ return 'KBA';} "); sb.Append("} "); return sb.ToString();}All this is done in the controller code.Let me know if there is any other good way to do. I will be waiting for your reply.
You can define the columns in your view as described in the documentation I have provided.
However, your approach is fine, too.