[ 4 posts ]

Eric Andrews

  • Username: infiniteline
  • Joined: Sat Jul 10, 2010 10:28 pm
  • Posts: 20
  • Offline
  • Profile

addRow doesn't use customFormatter?

Post Posted: Sat Sep 18, 2010 5:41 pm
+0-
Hey all,

I have a datatable in which a column has a custom formatter applied. When the initial data is loaded, everything works as expected. However, when I use addRow, the new row doesn't use the custom formatter. I know the data is there, but the datatable displays nothing. Do I need to re-apply the formatter to the new row somehow?

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: addRow doesn't use customFormatter?

Post Posted: Sun Sep 19, 2010 12:47 am
+0-
addRow does use custom formatters, what it doesn't do is use DataSource's parsers so you have to provide the data already converted to internal format, dates as instances of Date object and such. Formatters, if they cannot make sense of the data they receive, such as a date as a text string, will let it through untouched.

Eric Andrews

  • Username: infiniteline
  • Joined: Sat Jul 10, 2010 10:28 pm
  • Posts: 20
  • Offline
  • Profile

Re: addRow doesn't use customFormatter?

Post Posted: Sun Sep 19, 2010 9:40 am
+0-
The formatter is just changing the display based on the string data of the cell. For example, in one column if the data is "1", the formatter displays "Traditional"; in another it displays a certain picture based on the data.

Like I said, this works fine on the initial load, but when adding in a row there is nothing in the cells. Obviously, I'm over-looking something.

Eric Andrews

  • Username: infiniteline
  • Joined: Sat Jul 10, 2010 10:28 pm
  • Posts: 20
  • Offline
  • Profile
Tags:

Re: addRow doesn't use customFormatter?

Post Posted: Sun Sep 19, 2010 7:01 pm
+0-
OK, got it. Turns out that addRow was supplying an integer to the dataTable and the formatter was looking for a string. I thought that it would be able to automatically handle the typing issue, but it seems not.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron