Correct way to extend BaseSectionV2

Hello fellow creators! I have problems with extending BaseSectionV2 schema. I want to disable View button , so I  created a replacing module of BaseSectionV2 and wrote some code, but it's not working. Any advice would be much appreciated

 define("BaseSectionV2",[],function(){
	 return {
		 entitySchemaName:"Base",
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
				{
					"operation": "merge",
					"name": "AnalyticsModeViewOptionsButton",
					"parentName": "AnalyticsModeActionButtonsRightContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": { "bindTo": "Resources.Strings.ViewOptionsButtonCaption"},
						"enabled": { "bindTo": "checkIsAdmin"},
					 }
				}
 
		 ]/**SCHEMA_DIFF*/
	 };
  });
File attachments
Like 0

Like

2 comments
Best reply

Hi,

You need to override shema BaseDataView and modify the button SeparateModeViewOptionsButton:

  define("BaseDataView",[],function(){
	 return {
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
			 {
				"operation": "merge",
				"name": "SeparateModeViewOptionsButton",
				"values": {
					"enabled": { "bindTo": "checkIsAdmin"}
				}
			}
		 ]/**SCHEMA_DIFF*/
	 };
  });

 

Hi,

You need to override shema BaseDataView and modify the button SeparateModeViewOptionsButton:

  define("BaseDataView",[],function(){
	 return {
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
			 {
				"operation": "merge",
				"name": "SeparateModeViewOptionsButton",
				"values": {
					"enabled": { "bindTo": "checkIsAdmin"}
				}
			}
		 ]/**SCHEMA_DIFF*/
	 };
  });

 

Dmytro Vovchenko,

Thanks a lot! It worked!

Show all comments