SpreadJS 13
GC.Spread.Sheets Namespace / Worksheet type / bind Method
The event type.
Optional. Specifies additional data to pass along to the function.
Specifies the function to run when the event occurs.
In This Topic
    bind Method
    In This Topic
    Binds an event to the sheet.
    Syntax
    var instance = new GC.Spread.Sheets.Worksheet(name);
    var value; // Type: any
    value = instance.bind(type, data, fn);
    function bind( 
       type : string,
       data : Object,
       fn : Function
    ) : any;

    Parameters

    type
    The event type.
    data
    Optional. Specifies additional data to pass along to the function.
    fn
    Specifies the function to run when the event occurs.
    Example
    This example binds events.
    sheet.bind(GC.Spread.Sheets.Events.LeftColumnChanged,function(event,data)
      {
        var str = "----------------------------------------\n";
        var title = "Event [LeftColumnChanged ] Fired";
        str = str.substr(0, 4) + title + str.substr(4 + title.length);
        if (typeof data == "object") {
            for (var key in data) {
                str += key + " : " + data[key] + "\n";
              }
          } else {
            str += data + "\n";
          }
          alert(str);
      });
    sheet.bind(GC.Spread.Sheets.Events.TopRowChanged,function(event,data)
      {
            var str = "----------------------------------------\n";
            var title = "Event [TopRowChanged] Fired";
            str = str.substr(0, 4) + title + str.substr(4 + title.length);
            if (typeof data == "object") {
                for (var key in data) {
                    str += key + " : " + data[key] + "\n";
                }
            } else {
                str += data + "\n";
            }
            alert(str);
        });
    See Also

    Reference

    Worksheet type