zoukankan      html  css  js  c++  java
  • 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 

  • 相关阅读:
    事件的解除与绑定
    JavaScript 继承
    left 和 margin-left
    表格 DOM 操作
    基于继承的拖拽
    碰撞运动
    弹性运动
    完美运动框架
    JS 操作 Cookie
    DIV拖拽
  • 原文地址:https://www.cnblogs.com/TonyYPZhang/p/5161942.html
Copyright © 2011-2022 走看看