Is there anyway to handle different formatting for the same columns by row?
For example, the first row, I'd like to format all the numbers by percentage, and all subsequent rows format using currency. Do you suggest using javascript to handle the format individually or I even thought of combining 2 datagrids that look like 1. I'd prefer to control this through some sort of server-side event. Any thoughts, advice would be greatly welcome.
Hello,
It is possible by using the InitializeRow event. Just hook the event and modify the Items collection of the row currently initialized. Items collection is zero based.
In the example below, the second column of all even rows will be set to "1"
protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e) { if (e.Row.Index % 2 == 0) { e.Row.Items[1].Text = "1"; } }
You can use String.Format and the built-in .NET formating features to format the respective cells to anything you wish.
This only formats the data when it is first loaded. I am talking about formatting user data entry fields while they input them differently on row 1 and the rest of the rows.
I am not 100% sure that this is something supported in the grid out of the box. I see two modes that need to be supported in scenarios like that - the first one is maintaining the format while editing and the second one is maintaining the format of the value after it has been edited.
Currently our editing providers can be set on columns only, so I am not sure at this point the you can switch between different editing providers for individual cells in a column.
I believe that the best option at this point is to use client-side events like ExitEditMode and then the CSOM of the grid to manually format the value of the cell being editing to what you need based on the row index. I have just posted a pretty extensive CSOM example in your previous forum post that is close to what you need. The forum thread is located here:
http://forums.infragistics.com/forums/t/19303.aspx
Hope this helps.
Ok, I submitted a feature request: CAS-15515-FXIFR2
When I try this script it says that columnSetting is null. What am I doing wrong? I have defined a bunch of columns and set their EditingColumnSetting
eg.
<ig:EditingColumnSetting ColumnKey="DEC" EditorID="PercentProvider" />
I have tried several scenarios in javascript and server-side code, but was not able to find a way to bind an editor to a specific cell only - editors currently work only for the whole column.
But this is just me - hopefully, someone else can share his/her experience.