View model


Data object can be extended and converted to view model. This enables having additional fields which can be set in application and not depend on real view. All these values are dynamic and applies same binding rules as regular fields. It might be helpfull when you want to chage values and do not refresh data object.

Data grid uses field af_Selected to maintain selected rows.

To have multi select in R4 system, you should enable DataObjectViewModel and add field af_Selected to your data source.
			
			if(af.DataObject.useViewModels){ af.DataObject.useViewModels(); }
            dsYourDataObject.fields.push({"name":"af_Selected","type":"Boolean","defaultValue": false});	
			
		
There is also posiblity to enable view model on template or in article, by passing parameter to Datasources placeholder. This will add af_Selected for all dataobjects.
			
			@Render("DataSources",UseViewModels:"True")	
			
		

Related articles

Placeholder "LocalizeWeb2016" failed