This is a migrated thread and some comments may be shown as answers.

[Solved] Formatted Values not Correct

0 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kuangyi
Top achievements
Rank 1
Kuangyi asked on 22 Aug 2012, 03:40 PM
Hi, I have a very weird bug that popped up when I upgraded from an old version (2011.3.something) to 2012.2.607 with regards to my grid.

I have a date + decimal value (as well as a bunch of ints + strings).  When I apply formatting to the decimal + date value, the HTML that's in the response has the incorrect value; instead of having the date + decimal, it shows one of my other integers.  I've attached a project that reproduces my problem.

As you can see, ID, Date and Decimal are all the ID values.  If you switch the order in which they appear,

My grid ends up showing the ID for all formatted columns:

ID,.....,Date,.....Decimal
100,......,100,.....100
101,......,101,.....101

If I comment out the column.formats, I get unformated date (shown below) which I'll just denote as DATE_VALUE

Year 2011 Month 8 Day 1 Hour 0 Minute 0 Second 0 Millisecond 0 DayOfWeek Monday DayOfYear 213 Kind Utc Ticks 634477536000000000 TimeOfDay 00:00:00

ID,.....,Date,.....Decimal
100,......,DATE_VALUE,.....10.43
101,......,DATE_VALUE,.....8.12

I tried doing the formatting when I called columns.bound() instead, and the same thing happens still.

edit: I tried swapping order of columns... it seems that the first column affects it.

For example, I had my date column first and saw:
Date,...,ID...,Decimal
01/01/2012,....,100,....,0.00#
01/02/2012,....,101,....,0.00#
01/03/2012,....,102,....,0.00#
01/04/2012,....,103,....,0.00#

And if I had my decimal column first:
Decimal,....,ID,....,Date
10.43,.....,100,.....,mm/dd/yyyy

8.12,.....,101,.....,mm/dd/yyyy

1.33,.....,102,.....,mm/dd/yyyy

It seems like it either used the format that I specified as the string, or it tried applying the format to the value of the first column, failed, and just showed the format by default or something.  ID seems fine for whatever reason in these 2 cases.


edit 2: I've attached the sample proj.  If you switch the order of the columns (switch the order of Types.Add, Titles.Add and GridRowCellViewModels.Add) in home controller, it crashes saying "Specified format not valid", which I assume means it did try formatting each cell, but always used the first column's value.  It crashes in the sample proj, but in my project the first edit happens instead.

Tags
Grid
Asked by
Kuangyi
Top achievements
Rank 1
Share this question
or