Skip to content

Default field implementations don't pass the backing data item through template functions #466

@tonisostrat

Description

@tonisostrat

Looking at the core Field, editTemplate function is defined as:

editTemplate: function(value, item) {
    this._value = value;
    return this.itemTemplate(value, item);
}

which is all well and good.

However, all the concrete fields extending from it override that function and discard the item object. Following example is from SelectField:

editTemplate: function(value) {
    if(!this.editing)
        return this.itemTemplate(value);

    var $result = this.editControl = this._createSelect();
    (value !== undefined) && $result.val(value);
    return $result;
}

This means if I have a "perfect storm" combination where a field is non-editable and references other item properties to render itemTemplate() it will break the row-editing functionality because item = undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions