Consider this code:
Method zenSaveForm() [ ZenMethod ]
{
#Dim tRs As %ResultSet = ##class(%ResultSet).%New()
Set tQueryName= $CASE(..ReportParts,
"A":"QGetANormItems",
"B":"QGetBNormItems",
"C":"QGetCNormItems",
"A+B":"QGetABNormItems",
"A+B+C":"QGetABCNormItems",
"A+C":"QGetACNormItems",
"":$$$OK)
Set tStatement = ##class(%SQL.Statement).%New()
Set status = tStatement.
%PrepareClassQuery("nwP.MMR.Form.Item",tQueryName)
Set tRs = tStatement.%Execute(..Year,..CurrentForm)
Set tStorage = ##class(nwP.MMR.Data.Storage).
%OpenId(%session.Data("StorageID"))
While tRs.%Next(){
Set tItemId = tRs.%Get("ID")
Set ft = tRs.%Get("FieldType")
If ft="text"{ //nur normale Textwerte formatieren
Set tValue = ..getLogicValue(%page.
%GetComponentById(tItemId).value, tRs.%Get("ValueType"))
} Else {
Set tValue = %page.%GetComponentById(tItemId).value
}
Do tStorage.Content.SetAt(tValue, %page.
%GetComponentById(tItemId).id)
} Do tRs.%Close()
If $ZSTRIP(..SNAPSHOT,"*P") <
$ZSTRIP(tStorage.UpdateTSs.GetAt(..CurrentForm),"*P"){
/// At this point I call the show Dialog
&js<zenPage.jsOnShowDialog('FORMSAVECONFLICT');>
//// At this point I need the Action User choose
from the Dialog and distinguish the cases of the event
} Else {
Set ..SNAPSHOT = $ZDT($NOW(0),3,,6)
Do tStorage.UpdateTSs.SetAt( ..SNAPSHOT,..CurrentForm)
Set sc = tStorage.%Save()
&js<alert('Das Formular wurde erfolgreich zwischengespeichert!');>
}
For i=1:1:$L(..ComplexItemIDs,","){
Set componentID = $P(..ComplexItemIDs,",",i)
&js<
zenPage.getComponentById('#(componentID)#').getPage().zenSaveRecords();
>
}
Quit $$$OK
}
I hope i give you a better understanding of what i mean by pasting the
above code,
br,
Sebastian
On 13 Apr., 21:42, Sebastian Thiele <
sebastian.thi...@live.de> wrote:
> Ahh using smarthone Keyboard isnt that easy. Whatever i do i Need this
> mentioned zenmethos. But maybe this is the only way. One Idea... maybe
> onpopupaction could set a page property.
>
> Sebastian
> Am 13.04.2012 21:36 schrieb "Sebastian Thiele" <
sebastian.thi...@live.de>:
>
>
>
>
>
>
>
> > Ah ok but using the var value = ... only may it available in ethisch block
> > but i News it in the enclosing zenmethod
>
> > Erhards Sebastian
> > Am 13.04.2012 21:13 schrieb "Vlado" <
viliyc...@earthlink.net>:
>
> >> It should be:
>
> >> &js<var value=zenPage.jsOnShowDialog('#(evt)#');
>
> >> and
> >> ClientMethod onPopupAction(popupName, action, value) [ Language =
> >> javascript ]
> >> {
> >> .......
>
> >> return value;
> >> }
> >> but you will have problem with the synchronizing.
>
> >> The other way is to use event value(evt) as popupName :
>
> >> zenPage.launchPopupWindow(**zenLink('nwP.ZEN.Dialog.**
> >> UserDialog.cls'), evt,'status,**scrollbars,resizable,width=**
> >>> > ==============================**==============================**==============
>
> >>> > ClientMethod onPopupAction(popupName, action, value) [ Language =
> >>> > javascript ]
> >>> > {
> >>> > switch(popupName) {
> >>> > case 'Klienti':
> >>> > if (action == "ok") this.showDetailsKlienti(value)**;
> >>> > break;
> >>> > case 'NDok':
> >>> > if (action == "ok") this.showDetailsNDok(value);
> >>> > break;
> >>> > case 'Izdeliq':
> >>> > if (action == "ok") this.showDetailsIzdeliq(value)**;
> >>> > break;
> >>> > case 'Ambalaz':
> >>> > if (action == "ok") this.showDetailsAmbalaz(value)**;
> >>> > break;
> >>> > case 'Material':
> >>> > if (action == "ok") this.showDetailsMaterial(**value);
> >>> > break;
> >>> > case 'Usluga':
> >>> > if (action == "ok") this.showDetailsUsluga(value);
> >>> > break;
> >>> > }}
>
> >>> > ------------------------------**------------------------------**
> >>> ------------------------------**------------------------------**----
> >>> > ClientMethod showDetailsKlienti(id1) [ Language = javascript ]
> >>> > {
> >>> > var controller = zen('ctrlParent');
> >>> > var controller1 = zen('source1');
> >>> > controller1.setProperty('**modelId',id1);
>
> >>> > var nomer=controller1.**getDataByName('Nomer');
> >>> > var name=controller1.**getDataByName('Name');
> >>> > var danachenNomer=controller1.**getDataByName('DanachenNomer')**;
>
> >>> > zen('NomerKlient').setValue(**nomer);
> >>> > zen('NameKlient').setValue(**name);
> >>> > zen('DanachenNomer').setValue(**danachenNomer);
>
> >>> > controller.setDataByName('**Klient',id1);
> >>> > controller.setDataByName('**NomerKlient',nomer);
> >>> > controller.setDataByName('**NameKlient',name);
> >>> > controller.setDataByName('**DanachenNomer',danachenNomer);
>
> >>> > }
>
> >>> > ClientMethod showDetailsNDok(id1) [ Language = javascript ]
> >>> > {
> >>> > var controller = zen('source11');
> >>> > controller.setProperty('**modelId',id1);
>
> >>> > var nomerNEK=controller.**getDataByName('NomerNEK');
> >>> > var dataNEK=controller.**getDataByName('DataNEK');
> >>> > zen('NomerDokument').setValue(**nomerNEK);
> >>> > zen('DataDokument').setValue(**dataNEK);
>
> >>> > var controller1 = zen('ctrlChildren3');
> >>> > controller1.setDataByName('**IdNDok',id1);
> >>> > alert('id1='+id1);
> >>> > alert('ctrl1='+controller1.**getDataByName('IdNDok'));
> >>> > controller1.setDataByName('**NomerDokument',nomerNEK);
> >>> > controller1.setDataByName('**DataDokument',dataNEK);}
>
> >>> > ------------------------------**------------------------------**
> >>> ------------------------------**------------------------------**----------------
>
> >>> > Here I call different methods like this.showDetailsKlienti(**value);
> >>> > but they could be implemented in onPopupAction :
>
> >>> > ------------------------------**------------------------------**
> >>> ------------------------------**------------------------------**----------------
>
> >>> > ClientMethod onPopupAction(popupName, action, value) [ Language =
> >>> > javascript ]
> >>> > {
> >>> > switch(popupName) {
> >>> > case 'Klienti':
> >>> > if (action == "ok")
> >>> > {var controller = zen('ctrlParent');
> >>> > var controller1 = zen('source1');
> >>> > controller1.setProperty('**modelId',value);
>
> >>> > var nomer=controller1.**getDataByName('Nomer');
> >>> > var name=controller1.**getDataByName('Name');
> >>> > var danachenNomer=controller1.**getDataByName('DanachenNomer')**;
>
> >>> > zen('NomerKlient').setValue(**nomer);
> >>> > zen('NameKlient').setValue(**name);
> >>> > zen('DanachenNomer').setValue(**danachenNomer);
>
> >>> > controller.setDataByName('**Klient',value);
> >>> > controller.setDataByName('**NomerKlient',nomer);
> >>> > controller.setDataByName('**NameKlient',name);
> >>> > controller.setDataByName('**DanachenNomer',danachenNomer);**}
> >>> > break;
> >>> > case 'NDok':
> >>> > if (action == "ok") {....}
> >>> > ........
> >>> > ------------------------------**------------------------------**
> >>> ------------------------------**------------------------------**------
> >>> > ==============================**==============================**===
> >>> > Also you can use ZenProxy Object to transfer all the data.
>
> >>> > **Владо
>
> >>> > On Friday, April 13, 2012 8:32:31 AM UTC-7, sebth wrote:
>
> >>> > > Hi everybody,
>
> >>> > > I have a popup which is displayed under different circumstances.
> >>> This
> >>> > > Popup return a Value of a user taken action. I´ve already
> >>> > > "implemented" the onPopupAction(popupName, action, value). This
> >>> works
> >>> > > but setting a value into a page component is not that what i´d like
> >>> to
> >>> > > do.
>
> >>> > > Event occurs -> Popup is Displayed -> User click on Button in the
> >>> > > Popup -> the parent Window is notified on the PopupAction -> Capture
> >>> > > the Value... here is an example of what i am think about.
>
> >>> > > Method zenDoSomeThing() [ ZenMethod ] {
>
> >>> > > If condition = true {
> >>> > > &js<zenPage.jsOnShowDialog(**evt);>
>
> >>> > > }
>
> >>> > > }
>
> >>> > > /// Display our own Dialog pass an Event
> >>> > > ClientMethod jsOnShowDialog(evt) [ Language = javascript ]
> >>> > > {
> >>> > > var parms = new Object();
> >>> > > parms.EVENT = 'FORMSAVECONFLICT';
> >>> > > zenPage.launchPopupWindow(**zenLink('nwP.ZEN.Dialog.**UserDialog.cls'),
>
> >>> > > 'FORMSAVECONFLICT','status,**scrollbars,resizable,width=**500,height=300',parms);
>
> >>> > > }
>
> >>> > > /// if the event is received
> >>> > > ClientMethod onPopupAction(popupName, action, value) [ Language =
> >>> > > javascript ]
> >>> > > {
> >>> > > /// I dont want to call different methods based on the value wich
> >>> is
> >>> > > returned on the popupvalue
> >>> > > }
>
> >>> > > Is it possible to gather the Information onPopupAction() and use it
> >>> > > direct in zenDoSomeThing()?
>
> >>> > > Regards, Sebastian
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "InterSystems: Zen Community" group.
> >> To post to this group, send email to
InterSys...@googlegroups.com
> >> To unsubscribe from this group, send email to
> >>
InterSystems-Z...@googlegroups.com
> >> For more options, visit this group at
> >>
http://groups.google.com/group/InterSystems-ZEN?hl=en
> >> Zen Community Terms and Conditions:
> >>
http://groups.google.com/group/InterSystems-ZEN/web/community-terms-a...
> >
http://groups.google.com/group/InterSystems-ZEN/web/community-terms-a...