10000 Merge pull request #4 from AngelaIp/master · ArasLabs/custom-modal-dialog@895297c · GitHub
[go: up one dir, main page]

Skip to content

Commit 895297c

Browse files
authored
Merge pull request #4 from AngelaIp/master
Add Search dialog example
2 parents 8795b77 + f59df1e commit 895297c

File tree

4 files changed

+105
-11
lines changed

4 files changed

+105
-11
lines changed

Import/CustomModalDialog/Import/Form/labs_CustomModalDialogForm.xml

+58-6
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
<tab_stop>1</tab_stop>
4949
<textarea_cols>250</textarea_cols>
5050
<textarea_rows>50</textarea_rows>
51-
<x>255</x>
52-
<y>75</y>
51+
<x>100</x>
52+
<y>30</y>
5353
<name>param1</name>
5454
</Item>
5555
<Item type="Field" id="525A31E7FA884991B686D027AC8BD87B" action="add">
@@ -68,10 +68,62 @@
6868
<sort_order>768</sort_order>
6969
<source_id keyed_name="5051BFD61A9D4F829BA94E16E596537F" type="Body">5051BFD61A9D4F829BA94E16E596537F</source_id>
7070
<tab_stop>1</tab_stop>
71-
<x>255</x>
72-
<y>155</y>
71+
<x>100</x>
72+
<y>112</y>
7373
<name>param2</name>
7474
</Item>
75+
<Item type="Field" id="F20FD387B1E648A29D826A34A1AC1E05" action="add">
76+
<border_width>0</border_width>
77+
<display_length_unit>px</display_length_unit>
78+
<field_type>button</field_type>
79+
<font_color>#000000</font_color>
80+
<font_family>tahoma, arial, helvetica, sans-serif</font_family>
81+
<font_size>8pt</font_size>
82+
<font_weight>bold</font_weight>
83+
<is_disabled>0</is_disabled>
84+
<is_visible>1</is_visible>
85+
<label xml:lang="en">Search Parameter 3</label>
86+
<label_position>top</label_position>
87+
<list_no_blank>0</list_no_blank>
88+
<sort_order>896</sort_order>
89+
<source_id keyed_name="5051BFD61A9D4F829BA94E16E596537F" type="Body">5051BFD61A9D4F829BA94E16E596537F</source_id>
90+
<tab_stop>1</tab_stop>
91+
<x>451</x>
92+
<y>37</y>
93+
<name>searchDialog</name>
94+
<Relationships>
95+
<Item type="Field Event" id="3913C3E3AE1641D290FCEFEDF0929F54" action="add">
96+
<field_event>onclick</field_event>
97+
<related_id keyed_name="aip_CallSearchDialog" type="Method">
98+
<Item type="Method" action="get" select="id">
99+
<name>aip_CallSearchDialog</name>
100+
</Item>
101+
</related_id>
102+
<sort_order>128</sort_order>
103+
<source_id keyed_name="searchDialog" type="Field">F20FD387B1E648A29D826A34A1AC1E05</source_id>
104+
</Item>
105+
</Relationships>
106+
</Item>
107+
<Item type="Field" id="A2DC7E7FC71A4808ACDA82DB209BB14F" action="add">
108+
<border_width>0</border_width>
109+
<display_length_unit>px</display_length_unit>
110+
<field_type>text</field_type>
111+
<font_color>#000000</font_color>
112+
<font_family>tahoma, arial, helvetica, sans-serif</font_family>
113+
<font_size>8pt</font_size>
114+
<font_weight>bold</font_weight>
115+
<is_disabled>1</is_disabled>
116+
<is_visible>1</is_visible>
117+
<label xml:lang="en">Parameter 3</label>
118+
<label_position>top</label_position>
119+
<list_no_blank>0</list_no_blank>
120+
<sort_order>1024</sort_order>
121+
<source_id keyed_name="5051BFD61A9D4F829BA94E16E596537F" type="Body">5051BFD61A9D4F829BA94E16E596537F</source_id>
122+
<tab_stop>1</tab_stop>
123+
<x>451</x>
124+
<y>70</y>
125+
<name>searchResult</name>
126+
</Item>
75127
<Item type="Field" id="A5BD747B825946F0987A50146B596B4F" action="add">
76128
<border_width>0</border_width>
77129
<display_length_unit>px</display_length_unit>
@@ -88,8 +140,8 @@
88140
<sort_order>384</sort_order>
89141
<source_id keyed_name="5051BFD61A9D4F829BA94E16E596537F" type="Body">5051BFD61A9D4F829BA94E16E596537F</source_id>
90142
<tab_stop>1</tab_stop>
91-
<x>425</x>
92-
<y>149</y>
143+
<x>100</x>
144+
<y>142</y>
93145
<name>submit</name>
94146
<Relationships>
95147
<Item type="Field Event" id="D7DE5F5ED4244B08AC8F8FD8390CF065" action="add">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<AML>
2+
<Item type="Method" id="61FDB57AD8A349E8BB6E713537D75607" action="add">
3+
<comments />
4+
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
5+
<method_code><![CDATA[// Angela Ippisch - 16.10.2017
6+
//
7+
// onClick field event for Search button
8+
// Calls a search dialog and returns the search result
9+
10+
var param = {
11+
aras: top.aras,
12+
itemtypeName: 'Part', // tbd: use inArgs
13+
multiselect: false };
14+
15+
var options = { dialogHeight:450, dialogWidth:700, resizable:true};
16+
var searchedItem;
17+
18+
param.callback = function(dlgRes){
19+
if(!dlgRes) {
20+
return;
21+
}
22+
23+
searchedItem = dlgRes.item;
24+
if(!searchedItem){
25+
return;
26+
}
27+
var keyed_name = top.aras.getKeyedNameEx(searchedItem);
28+
var table = getFieldByName("searchResult").getElementsByTagName("input")[0];
29+
table.setAttribute("value", keyed_name);
30+
};
31+
32+
var wnd = top.aras.getMainWindow();
33+
wnd = wnd === top ? wnd.main : top;
34+
top.aras.modalDialogHelper.show('SearchDialog', wnd, param);]]></method_code>
35+
<method_type>JavaScript</method_type>
36+
<name>aip_CallSearchDialog</name>
37+
</Item>
38+
</AML>

Import/CustomModalDialog/Import/Method/labs_CallCustomModalDialog.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<AML>
1+
<AML>
22
<Item type="Method" id="24E3426DF5584E058154AE74E8969AD8" action="add">
33
<comments>Call custom form in dialog, then do something based on returned parameters</comments>
44
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
@@ -33,7 +33,7 @@ var params = {
3333
3434
var callback = function(res) {
3535
//Perform logic using dialog result here
36-
return alert("Param 1: " + res["param1"] + " ... Param 2: " + res["param2"]);
36+
return alert("Param 1: " + res["param1"] + " ... Param 2: " + res["param2"] + " ... Param 3: " + res["searchResult"]);
3737
}
3838
3939
// call form in dialog

Import/CustomModalDialog/Import/Method/labs_OnSubmitDialogMethod.xml

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<AML>
1+
<AML>
22
<Item type="Method" id="13859A53F6B1454182421F7CF3BE43CB" action="add">
33
<comments>Get field values to return to calling method</comments>
44
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
@@ -16,6 +16,10 @@ var p1 = wrapper1.getElementsByTagName("textarea")[0];
1616
var wrapper2 = getFieldByName("param2");
1717
var p2 = wrapper2.getElementsByTagName("input")[0];
1818
19+
// get search result
20+
var wrapper3 = getFieldByName("searchResult");
21+
var p3 = wrapper3.getElementsByTagName("input")[0];
22+
1923
// confirm fields were correctly retrieved
2024
if (!p1){
2125
alert("Can't find field param1");
@@ -30,8 +34,8 @@ if (!p2){
3034
var retVal = {};
3135
retVal["param1"] = p1.value;
3236
retVal["param2"] = p2.checked;
33-
34-
parent.returnValue = retVal;
37+
retVal["searchResult"] = p3.value;
38+
parent.returnValue = retVal;
3539
parent.close();
3640
]]></method_code>
3741
<method_type>JavaScript</method_type>

0 commit comments

Comments
 (0)
0