I would like to bind a textfield to a field in a record in that way that if the value in the record changes, the view automatically updates itself. The view should change transparently, like a grid view changes when the data in the undelying store gets modified.
Is it possible to bind an independent textfield to a record ? Or do I need to implement the update
event on the store myself ?
you can use the loadRecord()
method to load the record into the textfield but to update it on model changes you need to listen for the update
event like you said. if you have only one record in that store:
var me = this;
store.on('update', function(store, record, operation, modifiedFieldNames, eOpts) {
me.up('form').loadRecord(record);
}
ExtJS 5 (currently in beta) will provide a ViewModel for direct binding of a model to a view component.