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

 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 

原文地址:https://www.cnblogs.com/TonyYPZhang/p/5161942.html