Hi,
I want to format igGrid column for dates like "yyyy-mm-dd", dd-mm-yyyy 10:20Pm", .......
Is there any way to do it ??
Hello sanjaysutar ,
Flavio is right. You should use format property for the purpose
More information you can find in the help docs too
http://help.infragistics.com/NetAdvantage/jQuery/2012.2/CLR4.0?page=igGrid_Columns_and_Layout.html
http://help.infragistics.com/NetAdvantage/jQuery/2012.2/CLR4.0?page=Infragistics.Web.Mvc~Infragistics.Web.Mvc.GridColumn~Format.html
Let us know if you need further assistance.
Hi Tsvetelina,
It looks like we can give format options while specifying the columns.
What if I have hundreds of columns in the grid ?? Is there any way to specify only columns to which I want to apply for format ??
You should either define grid width or set the defaultColumnWidth option in order to make it work.
Best regards,
Martin Pavlov
Infragistics, Inc.
Hello
You haven't set DefaultColumnWidth.
Please see the answer of Martin Pavlov to another your post
http://ko.infragistics.com/community/forums/p/75190/380169.aspx#380251
Hope this helps
Yes the columns are autogenerated and there are over 100 of columns.
Out of those 100 columns lets say I want to format 2 columns which are of type DATETIME
As per your comment, I tried defining only a single column explicitly as below:
@(Html.Infragistics().Grid<Data>(Model.DataCollection).ID("mGrid")
.AutoGenerateColumns(true)
.Columns(col => { col.For(x => x.CreateDate).HeaderText("CreateDate").DataType("date").Format("MM-dd-yyyy h:mm:ss tt"); } ) .Height("600px") .DataBind() .Render() )
The above code only renders the explicitly defined column and does not render the remaining ones although AUTOGENERATECOLUMNSis set to TRUE.
Thank you for your update.
I am not sure how you want to manipulate these columns.
Are they autoGenerated and you want to format only the date columns or you define all of them but you need to specify format only to specific ones?
Thus the defined column will override the autogenerated one and the format will be applied to it.
You should keep in mind that in this case the defined columns will appear before the autogenerated ones.
For more information please refer to the help documentation:
http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/Deployment_Guide_JavaScript_Resouces.html#referencing_localization_resources
Hope hearing from you.