SpreadJS 14
GC.Spread.Sheets.CellTypes Namespace / Base class / isImeAware Method
The context associated with the cell type. See the Remarks for more information.
In This Topic
    isImeAware Method
    In This Topic
    Whether this cell type is aware of IME.
    Syntax
    var instance = new GC.Spread.Sheets.CellTypes.Base();
    var value; // Type: boolean
    value = instance.isImeAware(context);
    function isImeAware( 
       context : Object
    ) : boolean;

    Parameters

    context
    The context associated with the cell type. See the Remarks for more information.

    Return Value

    true if the cell type is aware of IME; otherwise, false.
    Example
    This example uses the isImeAware method.
       function NameCellType() {
        }
        NameCellType.prototype = new GC.Spread.Sheets.CellTypes.Base();
        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 GC.Spread.Sheets.ImeMode.Auto: $input.css("ime-mode", "auto"); break;
                    case GC.Spread.Sheets.ImeMode.Active: $input.css("ime-mode", "active"); break;
                    case GC.Spread.Sheets.ImeMode.Inactive: $input.css("ime-mode", "inactive"); break;
                    case GC.Spread.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 GC.Spread.Sheets.Sheet instance Indicates the current sheet.
    context.row number The row index.
    context.col number The column index.
    context.sheetArea GC.Spread.Sheets.SheetArea The current sheet area.
    See Also

    Reference

    Base class