Last post Jul 27, 2012 01:08 AM by KDegrave
May 29, 2012 12:45 PM|nssidhu100|LINK
I am trying to figure out how to Bind Save button's enable Property to upshot's dataSource, so that whenever there isa change in dataSource
button(entityState!='unmodified') is enabled and disabled otherwise.
May 29, 2012 12:56 PM|Mudasir.Khan|LINK
May 29, 2012 12:57 PM|Mudasir.Khan|LINK
create a Proeprty which will return boolean for example
public bool isUnmodified
bind isUnmodified to Enabled property
May 29, 2012 01:24 PM|nssidhu100|LINK
I should have been more clear on this.
I am looking to subscribe to EntityState property of DataSource so that whenever there is change in Datasource, i can enable or disbale my button.
Jul 27, 2012 01:08 AM|KDegrave|LINK
I think the way to do this is by defining a boolean propertie in your viewmodel of the entity. For example
self.hasChanges = data.isChanged;
When you done this, you can simply bind this property to the enable attribute of the save button in your form
<input type="submit" data-bind="enable: hasChanges()" value="save" />
Hope this will help.