Skip to content

Two-way binding not possible using complex model #74

@swalters

Description

@swalters

If I try to create an editable cell template using the example from the workbench, I get errors when using a complex property like Component.Item.ItemDesc.

cellTemplate: '<input ng-model="row.entity[col.field]"

The default cell template uses {{row.getProperty(col.field) CUSTOM_FILTERS}}, but we can't use row.getProperty with ng-model because it needs a settable value.

I think the solution is to not use row.getProperty(col.field), but instead natively bind Angular to the property referenced in col.field. The only way I can see to do this is to implement the same logic used for CUSTOM_FILTERS. I created another variable named COL_FIELD and replace this value in the directive with actual value. This seems to work for one-way and two-way binding when complex models are used. So now the dafult celltemplate uses {{COL_FIELD CUSTOM_FILTERS}}. We can easily create two-way binding template with ng-model="COL_FIELD" .

Pull request soon to follow. Hopefully, I'm on the right track.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions