留言板

Datatable - emptyMessage

Ryan Stapleton,修改在9 年前。

Datatable - emptyMessage

New Member 帖子: 5 加入日期: 14-8-1 最近的帖子
I seem to be missing something and I hope its something simple.

I have a datatable that I am loading with a datasource.io (JSON with Y.Plugin.DataSourceJSONSchema) and the table loads on page load like I want. I have a datepicker so I can change a date and it loads the new set of data again like I am looking for.

The problem I have if the particular date does not have any date it does not show an emptyMessage correctly.

When I add the 'datatable-message' to the YUI().use I get some extra space between the header and table body for the initialRequest of data which isn't right. When I goto another date that does not have data I get my emptyMessage message but any set of data after that it shows the emptyMessage regardless if there is data in the table or not.

I link the datasource to the datatable with:

 table.plug( Y.Plugin.DataTableDataSource, {
  datasource: myDataVar,
  initialRequest: url
});


Where myDataVar is the var created with:
  var myDataVar =  new Y.DataSource.IO({ source: url });

url is the url of the JSON returning servlet.

Any thoughts?
Ryan Stapleton,修改在9 年前。

RE: Datatable - emptyMessage (答复)

New Member 帖子: 5 加入日期: 14-8-1 最近的帖子
I feel this is a hack but seems to work.

I got the data from the table:

var data = node.get('data');
if the thisdata.size() == 0 {
  Y.one('tbody.table-message').show();
} else {
  Y.one('tbody.table-message').hide();
}


I kinda assumed this would be built in...