SpreadJS Documentation
updateImeMode Method
The DOM element that was created by the createEditorElement method.
The ime-mode from the cell's actual style.
The context associated with the cell type. See the Remarks for more information.
Updates the editor's ime-mode.
Syntax
var instance = new GcSpread.Sheets.CustomCellType();
var value; // Type: any
value = instance.updateImeMode(editorContext, imeMode, context);
function updateImeMode( 
   editorContext : object,
   imeMode : ImeMode,
   context : object
) : any;

Parameters

editorContext
The DOM element that was created by the createEditorElement method.
imeMode
The ime-mode from the cell's actual style.
context
The context associated with the cell type. See the Remarks for more information.
Example
This example uses the updateImeMode method.
   function NameCellType() {
    }
    NameCellType.prototype = new GcSpread.Sheets.CustomCellType();
    NameCellType.prototype.updateEditor = function (editorContext, cellStyle, cellRect, context) {
        if (editorContext) {
            $(editorContext).width(cellRect.width);
            $(editorContext).height(cellRect.height + 20);
        }
    };
    NameCellType.prototype.createEditorElement = function (context) {
        var div = document.createElement("div");
        var $div = $(div);
        $div.attr("gcUIElement", "gcEditingInput");
        $div.css("background-color", "white");
        $div.css("position", "absolute");
        $div.css("overflow", "hidden");
        $div.css("border", "2px #5292f7 solid");
        var $span1 = $("<span>Enter Your Name</span>");
        $span1.css("display", "block");
        var $input1 = $("<input type='text'/>");
        $div.append($span1);
        $div.append($input1);
        return div;
    };
    NameCellType.prototype.getEditorValue = function (editorContext, context) {
        if (editorContext) {
            var input1 = editorContext.children[1];
            var name = $(input1).val();
            return name;
        }
    };
    NameCellType.prototype.setEditorValue = function (editorContext, value, context) {
        if (editorContext) {
            if (value) {
                var input1 = editorContext.children[1];
                $(input1).val(value);
            }
        }
    };
    NameCellType.prototype.focus = function (editorContext, context) {
        if (editorContext) {
            $(editorContext.children[1]).focus();
        }
    };
    NameCellType.prototype.isImeAware = function (context) {
        return true;
    }
    NameCellType.prototype.updateImeMode = function (editorContext, imeMode, context) {
        if (editorContext) {
            var $input = $(editorContext.children[1]);
            switch (imeMode) {
                case GcSpread.Sheets.ImeMode.Auto: $input.css("ime-mode", "auto"); break;
                case GcSpread.Sheets.ImeMode.Active: $input.css("ime-mode", "active"); break;
                case GcSpread.Sheets.ImeMode.Inactive: $input.css("ime-mode", "inactive"); break;
                case GcSpread.Sheets.ImeMode.Disabled: $input.css("ime-mode", "disabled"); break;
            }
        }
    }
sheet.setCellType(1,1,new NameCellType());
Remarks

The context parameter can include the following items:

Item Type Description
context.sheet GcSpread.Sheets.Sheet instance Indicates the current sheet.
context.row number The row index.
context.col number The column index.
context.sheetArea GcSpread.Sheets.SheetArea The current sheet area.

 

See Also

Reference

CustomCellType type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.