Search code examples
javascriptyui

Can YUI2 DataTable utilize YUI3 DataSource?


I am currently learning to use the YUI2 DataTable. (I will learn the YUI3 DataTable when it supports inline cell editing).

My question is simple - can I use it with the YUI3 DataSource or must I use YUI2 DataSource?


Solution

  • You will have to provide a YUI2 DataSource when you create a DataTable instance if only to keep it happy. It might be a local datasource pointing to an empty array, but the YUI2 DataSource must be there. Later on, you may use any means you want to actually fetch the data and, once you have it, call onDataReturnInitializeTable which is what YUI2 does. You cannot provide a YUI3 DataSource in the constructor, they have different interfaces, DataTable would not know what to do with it.