创建用户控件
Creating a User-Control
Genexus Evo3
我正在尝试使用 Atom 创建用户控件;它必须根据用户输入创建 X 行和 Y 列的 table,为此我创建了 UC 并将其放在新 KB 上的模拟 Web 面板上,但是当我打开 Web 面板时 Chrome 控制台 returns:
未捕获的引用错误:[UserControlName] 未定义
这些是我的代码:
////TestRender.js
function test($)
{
this.show = function()
{ var html = ''
html += '<div class="grid">';
html += '<table>';
for (var i = 0; i < this.TableCreate.EjeX; i++) {
html += '<tr></tr>'
for (var j = 0; j < this.TableCreate.EjeY; i++) {
html += '<td></td>'
}
}
html += '</table>'
html += '</div>'
this.setHtml(html);
}
this.destroy = function()
{
// Add your cleanup code here. This method will be called when the control is destroyed.
}
this.GetGrid = function()
{
return this.Grid;
}
this.SetGrid = function(data)
{
this.Grid = data;
}
}
////test_Properties.xml
<?xml version="1.0"?>
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Object id="test_tlc">
<Group>
<Name>General</Name>
<Type>Main</Type>
<Children>
<Prop>
<Id>TableCreate</Id>
<Name>TableCreate</Name>
<Type>Custom</Type>
<CustomType> Artech.GeneXus.Common.CustomTypes.ControlAttVarReference, Artech.GeneXus.Common </CustomType>
<Metadata>
<Value name="FlagSetValueMethod">SetGrid</Value>
<Value name="FlagGetValueMethod">GetGrid</Value>
<Value name="FlagDataTypeFilter">SDTTest_tlc</Value>
</Metadata>
</Prop>
</Children>
</Group>
</Object>
</Content>
////test.control
<?xml version="1.0"?>
<ControlDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Id>ad325e28-203d-48da-a49f-6ef4266d235a</Id>
<Name>test_tlc</Name>
<Description>test_tlc</Description>
<ObjClass>test_tlc</ObjClass>
<Version>1.00.00</Version>
<RuntimeRender>test_tlcRender.js</RuntimeRender>
<PropertiesDefinition>test_tlcProperties.xml</PropertiesDefinition>
<DesignRender>test_tlcRender.xsl</DesignRender>
<GxResources>sdtTest_tlc.xpz</GxResources>
<ShowMethod>show</ShowMethod>
<ResizeSupported>false</ResizeSupported>
<DataSourceAllowed>None</DataSourceAllowed>
<CustomDataSources />
<AutoGrowSupported>false</AutoGrowSupported>
<IncludeInControlInfo>false</IncludeInControlInfo>
<SupportFiles />
<iOS_SupportFiles />
<Android_SupportFiles />
<BB_SupportFiles />
<Platforms>
<Platform>Web</Platform>
<Platform>WebLayout</Platform>
</Platforms>
<ReferencedFiles>
<File>style.css</File>
</ReferencedFiles>
<iOS_ReferencedFiles />
<Android_ReferencedFiles />
<BB_ReferencedFiles />
<Constructor>
<Parameters />
<Name>test_tlc</Name>
</Constructor>
<ControlType></ControlType>
<Categories />
<Events>
<!-- <Event>EventName</Event> -->
</Events>
<Methods>
<!-- <Method>
<Name>MethodName</Name>
<Signature>SetMode( myMode: Modes, text: Character)</Signature>
<Parameters>
<Parameter>Modes</Parameter>
<Parameter>Character</Parameter>
</Parameters>
</Method> -->
</Methods>
<Actions>
<!-- Declare new variable
<Action>
<Order>0</Order>
<ActionProperties>
<Property>
<Key>
<string>Name</string>
</Key>
<Value>
<string>VariableName</string>
</Value>
</Property>
<Property>
<Key>
<string>ATTCUSTOMTYPE</string>
</Key>
<Value>
<string>Variable Type</string>
</Value>
</Property>
</ActionProperties>
<Data />
<ActionType>VarDeclaration</ActionType>
</Action> -->
<!-- Se control property
<Action>
<Order>1</Order>
<ActionProperties>
<Property>
<Key>
<string>PropertyName</string>
</Key>
<Value>
<string>&MyVariable</string>
</Value>
</Property>
</ActionProperties>
<Data />
<ActionType>SetPropertyToControl</ActionType>
</Action>
-->
<!-- Code Snippet
<Action>
<Order>2</Order>
<ActionProperties />
<Data>
// Events from gpxJSBuffer
Event Start
msg("Hello world!")
EndEvent
</Data>
<ActionType>CodeSnippet</ActionType>
</Action>
-->
</Actions>
<IsPublic>true</IsPublic>
<Android_IsScrollable>false</Android_IsScrollable>
</ControlDefinition>
把UC移动到gx安装的对应目录后,再做一个"/install"。
Genexus Evo3
我正在尝试使用 Atom 创建用户控件;它必须根据用户输入创建 X 行和 Y 列的 table,为此我创建了 UC 并将其放在新 KB 上的模拟 Web 面板上,但是当我打开 Web 面板时 Chrome 控制台 returns:
未捕获的引用错误:[UserControlName] 未定义
这些是我的代码:
////TestRender.js
function test($)
{
this.show = function()
{ var html = ''
html += '<div class="grid">';
html += '<table>';
for (var i = 0; i < this.TableCreate.EjeX; i++) {
html += '<tr></tr>'
for (var j = 0; j < this.TableCreate.EjeY; i++) {
html += '<td></td>'
}
}
html += '</table>'
html += '</div>'
this.setHtml(html);
}
this.destroy = function()
{
// Add your cleanup code here. This method will be called when the control is destroyed.
}
this.GetGrid = function()
{
return this.Grid;
}
this.SetGrid = function(data)
{
this.Grid = data;
}
}
////test_Properties.xml
<?xml version="1.0"?>
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Object id="test_tlc">
<Group>
<Name>General</Name>
<Type>Main</Type>
<Children>
<Prop>
<Id>TableCreate</Id>
<Name>TableCreate</Name>
<Type>Custom</Type>
<CustomType> Artech.GeneXus.Common.CustomTypes.ControlAttVarReference, Artech.GeneXus.Common </CustomType>
<Metadata>
<Value name="FlagSetValueMethod">SetGrid</Value>
<Value name="FlagGetValueMethod">GetGrid</Value>
<Value name="FlagDataTypeFilter">SDTTest_tlc</Value>
</Metadata>
</Prop>
</Children>
</Group>
</Object>
</Content>
////test.control
<?xml version="1.0"?>
<ControlDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Id>ad325e28-203d-48da-a49f-6ef4266d235a</Id>
<Name>test_tlc</Name>
<Description>test_tlc</Description>
<ObjClass>test_tlc</ObjClass>
<Version>1.00.00</Version>
<RuntimeRender>test_tlcRender.js</RuntimeRender>
<PropertiesDefinition>test_tlcProperties.xml</PropertiesDefinition>
<DesignRender>test_tlcRender.xsl</DesignRender>
<GxResources>sdtTest_tlc.xpz</GxResources>
<ShowMethod>show</ShowMethod>
<ResizeSupported>false</ResizeSupported>
<DataSourceAllowed>None</DataSourceAllowed>
<CustomDataSources />
<AutoGrowSupported>false</AutoGrowSupported>
<IncludeInControlInfo>false</IncludeInControlInfo>
<SupportFiles />
<iOS_SupportFiles />
<Android_SupportFiles />
<BB_SupportFiles />
<Platforms>
<Platform>Web</Platform>
<Platform>WebLayout</Platform>
</Platforms>
<ReferencedFiles>
<File>style.css</File>
</ReferencedFiles>
<iOS_ReferencedFiles />
<Android_ReferencedFiles />
<BB_ReferencedFiles />
<Constructor>
<Parameters />
<Name>test_tlc</Name>
</Constructor>
<ControlType></ControlType>
<Categories />
<Events>
<!-- <Event>EventName</Event> -->
</Events>
<Methods>
<!-- <Method>
<Name>MethodName</Name>
<Signature>SetMode( myMode: Modes, text: Character)</Signature>
<Parameters>
<Parameter>Modes</Parameter>
<Parameter>Character</Parameter>
</Parameters>
</Method> -->
</Methods>
<Actions>
<!-- Declare new variable
<Action>
<Order>0</Order>
<ActionProperties>
<Property>
<Key>
<string>Name</string>
</Key>
<Value>
<string>VariableName</string>
</Value>
</Property>
<Property>
<Key>
<string>ATTCUSTOMTYPE</string>
</Key>
<Value>
<string>Variable Type</string>
</Value>
</Property>
</ActionProperties>
<Data />
<ActionType>VarDeclaration</ActionType>
</Action> -->
<!-- Se control property
<Action>
<Order>1</Order>
<ActionProperties>
<Property>
<Key>
<string>PropertyName</string>
</Key>
<Value>
<string>&MyVariable</string>
</Value>
</Property>
</ActionProperties>
<Data />
<ActionType>SetPropertyToControl</ActionType>
</Action>
-->
<!-- Code Snippet
<Action>
<Order>2</Order>
<ActionProperties />
<Data>
// Events from gpxJSBuffer
Event Start
msg("Hello world!")
EndEvent
</Data>
<ActionType>CodeSnippet</ActionType>
</Action>
-->
</Actions>
<IsPublic>true</IsPublic>
<Android_IsScrollable>false</Android_IsScrollable>
</ControlDefinition>
把UC移动到gx安装的对应目录后,再做一个"/install"。