[ 6 posts ]

Baby Steps Design Group

  • Username: babysteps
  • Joined: Fri Jan 15, 2010 9:03 am
  • Posts: 12
  • GitHub: babysteps
  • Gists: babysteps
  • Offline
  • Profile

DataTable message classes not being removed

Post Posted: Tue Jan 26, 2010 7:33 pm
+0-
I have chosen to use a different loader than the loader div in the DataTable, so I have added the display:none attribute to the yui-dt-loading class. This way, when the message tbody is made visible, the loading div still doesn't show.

Now I want to show the message area when an error occurs or if there are no records. So, I saw that there is a yui-dt-empty and yui-dt-error class that get applied to this div as well. The problem is, that these classes are being added when the corresponding message is shown, but not being removed when the message is removed.

Example:

When the dataset comes back empty, the 'No Records' message is displayed, and the yui-dt-empty class is applied to the div, but the yui-dt-loading class is not removed. Same problem when 'No Records' is removed, the yui-dt-empty class is not removed.

I am using 2.8.0r4

Thanks in advance for your help.

Matt M

  • Username: mmckeon
  • Joined: Fri Sep 04, 2009 6:42 am
  • Posts: 51
  • Offline
  • Profile

Re: DataTable message classes not being removed

Post Posted: Tue Jan 26, 2010 9:37 pm
+0-
I believe this is either by design or a bug, but I don't see anything in the DT code that would remove the yui-dt-loading attribute. Perhaps you can fix this by tapping into the post render event?

Code:
mydatatable.on('postRenderEvent', function () {
   if (this._elTbody.rows.length === 0) {
      YAHOO.util.Dom.removeClass(this._elMsgTd, 'yui-dt-loading');
   }
})

Matt M

  • Username: mmckeon
  • Joined: Fri Sep 04, 2009 6:42 am
  • Posts: 51
  • Offline
  • Profile
Tags:

Re: DataTable message classes not being removed

Post Posted: Tue Jan 26, 2010 9:38 pm
+0-
Come to think of it you probably don't even need to check that there are no records, just remove it at postRenderEvent.

Sean Fitzsimmons

  • Username: seanf
  • Joined: Wed Sep 16, 2009 6:16 am
  • Posts: 78
  • Location: Baltimore, Maryland, USA
  • Offline
  • Profile

Re: DataTable message classes not being removed

Post Posted: Wed Jan 27, 2010 2:23 am
+0-
I also did not want the message in the table as I display a loading message outside the table. I just set the MSG_EMPTY table configuration attribute to an empty string. Note, setting it to null doesn't work as the YUI code interprets this as the configuration attribute not being set and uses the default.

Sean Fitzsimmons

  • Username: seanf
  • Joined: Wed Sep 16, 2009 6:16 am
  • Posts: 78
  • Location: Baltimore, Maryland, USA
  • Offline
  • Profile

Re: DataTable message classes not being removed

Post Posted: Wed Jan 27, 2010 2:24 am
+0-
Sorry, meant to say MSG_LOADING attribute.

Baby Steps Design Group

  • Username: babysteps
  • Joined: Fri Jan 15, 2010 9:03 am
  • Posts: 12
  • GitHub: babysteps
  • Gists: babysteps
  • Offline
  • Profile

Re: DataTable message classes not being removed

Post Posted: Tue Feb 09, 2010 8:53 am
+0-
That worked perfectly! Thank you.
  [ 6 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