首页 > 其他 > 详细

dojox.grid.EnhancedGrid 和 dojox.grid.DataGrid 的继承关系

时间:2016-01-27 00:41:09      阅读:385      评论:0      收藏:0      [点我收藏+]

 dojox.grid.EnhancedGrid  的介绍说, EnhancedGrid 是基于 DataGrid 提供增强功能的。

EnhancedGrid (dojox.grid.EnhancedGrid) provides a rich set of features that enhance the capabilities of base DataGrid. All these features are implemented as separate plugins which can be loaded on demand, the required features must be declared before used.

不引入插件的 EnhancedGrid 就像 DataGrid 一样。

所有,可以理解为 EnhancedGrid 是继承 DataGrid 的。或者说, EnhancedGrid 的原型是 DataGrid。

 

下面用代码证明 : 

    var grid = new dojox.grid.EnhancedGrid({
        id: ‘grid‘,
        store: store,
        structure: layout,
        rowSelector: ‘20px‘},
      document.createElement(‘div‘));

    console.log(dojox.grid.EnhancedGrid.prototype.isPrototypeOf(grid));
    console.log(dojox.grid.DataGrid.prototype.isPrototypeOf(grid));

返回结果为 :

true 

true

EnhancedGrid 和 DataGrid 都是 EnhancedGrid Object 的原型。

 

    grid = new DataGrid({
        id: ‘grid‘,
        store: store,
        structure: layout,
        rowSelector: ‘20px‘});

    console.log(dojox.grid.EnhancedGrid.prototype.isPrototypeOf(grid));
    console.log(dojox.grid.DataGrid.prototype.isPrototypeOf(grid));

返回结果为 : 

false

true

EnhancedGrid 不是 DataGrid Object 的原型,只有 DataGrid 是 DataGrid Object 的原型。

 

所有,可以理解为 EnhancedGrid 是继承于 DataGrid

 

参考 : 

Object.prototype.isPrototypeOf(), mozilla

How to get a JavaScript object‘s class?, stackoverflow 

 

dojox.grid.EnhancedGrid 和 dojox.grid.DataGrid 的继承关系

原文:http://www.cnblogs.com/TonyYPZhang/p/5161942.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!