Add Virtual Detail on Page

I am trying to add Virtual Detail that will contain records which don't exist in DataBase.

Now I have Detail connected to Object "Card" and After clicking Get card I am calling Get method which returns Data which I Parse in my Detail . But records exists in DataBase and i want to make it virtual.

 

I am following https://community.creatio.com/articles/add-virtual-detail-page,

1.I Created Virtual Object .

2. I did not created service while we are making API call which will returns Data. 

3. I Created virtual detail. 

4. I Insert virtual detail into Contact page.

Error: As we see in collection there is my data and thats fine but I can not read Column in virtual Object. 

 

Please help how can i solve this issue and how to add virtual detail in proper way

Like 0

Like

2 comments

Here is an example of code for the detail that will input values from the custom array into the detail. Please also note that this approach will only work if the detail contains at least 1 record (in case there are no records you will need to click the button twice for the array content to be displayed in the page). Also don't forget to add the LoadGridButtonCaption localizable string to your detail schema:

define("UsrSchema130af5ebDetail", [], function() {
	return {
		entitySchemaName: "UsrTestDetail",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		attributes: {
			IsGridEmpty: {
                    dataValueType: this.Terrasoft.DataValueType.BOOLEAN,
                    value: true
                }
		},
		diff: /**SCHEMA_DIFF*/[
			{
                "operation": "insert",
                "name": "LoadGridButton",
                "parentName": "Detail",
                "propertyName": "tools",
                "values": {
                    "itemType": Terrasoft.ViewItemType.BUTTON,
                    "caption": {"bindTo": "Resources.Strings.LoadGridButtonCaption"},
                    "click": {"bindTo": "onLoadGridButtonClick"},
                    "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT
                }
            }
		]/**SCHEMA_DIFF*/,
		methods: {
			onLoadGridButtonClick: function() {
				//object to load data from
				var object = [
					{
						UsrName: "1111",
						UsrIntColumn: 1
					},
					{
						UsrName: "Test2",
						UsrIntColumn: 24
					}
				];
				//create view model for the object items
				var newCollection = Ext.create("Terrasoft.Collection");
				Terrasoft.each(object, function(item, key) {
					var model = Ext.create("Terrasoft.BaseViewModel", {
						rowConfig: {
							Id: {
								columnPath: "Id",
								dataValueType: Terrasoft.DataValueType.GUID
							},
							UsrName: {
								columnPath: "UsrName",
								dataValueType: Terrasoft.DataValueType.TEXT
							},
							UsrIntColumn: {
								columnPath: "UsrIntColumn",
								dataValueType: Terrasoft.DataValueType.INTEGER
							}
						},
						values: {
							Id: Terrasoft.generateGUID(),
							UsrName: item.UsrName,
							UsrIntColumn: item.UsrIntColumn,
						}
					}, this);
					newCollection.add(model.get("Id"), model);
				});
				//add new collection items from the created model
 
 
				//get current Grid collection
				var collection = this.get("Collection");
				//empty current Grid collection
				collection.clear();
				//add Grid collection items from the new collection
				collection.loadAll(newCollection);
				//specify that Grid data is loaded
				this.set("IsGridEmpty", false);
			}
		}
	};
});

Oleg Drobina,

It works, Thanks a lot.

Show all comments