Docs
API
  • controllers

    Array

    Context menu is specific sub widget of grid.


    To start work with controller, it needs to define it over FancyGrid.defineController

    name

    String

    Control name.
    Must be unique.
    Use namespaces if needed: "App.myCotroller".

    params

    Object

    Params with handlers, functions and controls property.

    Controller with events

    Sample:

    
    FancyGrid.defineController('mycontrol', {
      onCellClick: function(grid, o){
        
      },
      onCellDBLClick: function(grid, o){
        
      }
    });
    
    var grid = new FancyGrid({
      ...
      events: [{
        cellclick: 'onCellClick'
      },{
        celldblclick: 'onCellDBLClick'
      }],
      controllers: ['mycontrol'],
      ...
    });
    

    Controls instead of events

    Sample:

    
    FancyGrid.defineController('mycontrol', {
      controls: [{
        event: 'cellclick',
        handler: 'onCellClick'
      },{
        event: 'celldblclick',
        handler: 'onCellDBLClick'
      }],
      onCellClick: function(grid, o){
        
      },
      onCellDBLClick: function(grid, o){
        
      }
    });
    
    var grid = new FancyGrid({
      ...
      controllers: ['mycontrol'],
      ...
    });
    

    Control selector

    Sample:

    
    FancyGrid.defineController('mycontrol', {
      controls: [{
        event: 'cellclick',
        selector: '.sign-minus',
        handler: 'onClickMinus'
      },{
        event: 'cellclick',
        selector: '.sign-plus',
        handler: 'onClickPlus'
      }],
      onClickMinus: function(grid, o){
        
      },
      onClickPlus: function(grid, o){
        
      },
    });
    
    var grid = new FancyGrid({
      ...
      controllers: ['mycontrol'],
      ...
    });
    

    List of controls properties

    event

    String

    Grid event name and dom event name.

    selector

    String

    Not required. Delegator(source element).

    handler

    Function

    Handler of event.

    Default

    
    undefined