| Page 1 of 1 | [ 5 posts ] |
|
I am doing a little work on DataTable that I want to seal some logics into DataTable.
When I extend a DataTable like this: Code: function TestTable(config) { TestTable.superclass.constructor.apply(this, arguments); }; TestTable.NAME = "TestTable"; Y.extend(TestTable, Y.DataTable); Y.TestTable = TestTable; And then in page I call like this: Code: var table = new Y.TestTable({ columns: ...... scrollable: 'y', height: '560px', data: ports }).render('#dtable'); It shows the table and data, but not with the right view style, if I just call new Y.DataTable, that view show fine. What is the problem? Did I miss something to do with TestTable? |
|
Check the classes that are being set on the boundingBox and contentBox. If you change NAME, then I think you will get yui3-TestTable instead of yui3-datatable
|
|
Jafl,
If that were the case, it would be a bug. The boundingBox has classNames derived from the NAME property in all the classes in the inheritance chain, thus, no styles are lost in the subclasses. If this should happen it might be a bug often due to using the className of the contentBox, which is derived from only the last descendant, instead of that of the boundingBox or classNames generated dynamically using the latest NAME. Whichever the case, it would be good to report it as a bug as styling is not meant to be redone from scratch when subclassing but overridden if required. |
Alberto SantiniYUI Contributor
|
|
|
Satyam, I don't think that's correct. Widgets use `this.getClassName('foo')` to assign css classes to their DOM components, which derives from the class's NAME. Subclasses that override the NAME are expected to produce css classes that don't match the sam skin.
While I think it would be convenient for subclasses to retain styling by default, I don't know how to reconcile that with the current use of getClassName(), since the method exists on Widget.prototype specifically to generate NAME specific class names. caigb, There's probably no real need for you to assign a new NAME to your DT subclass, since it is used only for event prefixing and css classname generation. You can Y.Base.create('datatable', Y.DataTable.Base, [...]) all you'd like without conflicting with core DT classes or instances. |
| Page 1 of 1 | [ 5 posts ] |
| 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 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group