delagoutte Posted August 8, 2017 Posted August 8, 2017 hello, i would like acces to the property iconCls of a menu item http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.menu.Item How can i do it with unigui ? Quote
Sherzod Posted August 8, 2017 Posted August 8, 2017 Hi, One of the possible solutions at the moment I think: procedure TMainForm.UniFormReady(Sender: TObject); begin UniSession.AddJS(Self.Name+'.'+Item11.Name+'.setIconCls("test");'); end; Best regards, Quote
delagoutte Posted August 8, 2017 Author Posted August 8, 2017 Thanks a lot again. of course it's working Quote
delagoutte Posted September 7, 2017 Author Posted September 7, 2017 New question : i'm using your code like this : procedure SetMenuItemImg(aForm : TUniForm;aMenuItem : TUniMenuItem; aSvg : string); begin UniSession.AddJS(aForm.Name+'.'+aMenuItem.Name+'.setIconCls("'+UniMainModule.MainColorClass+' fs16 '+aSvg+'");'); end; Now my menu is on a TuniFrame. if i change uniform by uniframe it is not working. How can i do it or how can i access to JSName or JsId property for my frame ? Quote
Sherzod Posted September 7, 2017 Posted September 7, 2017 Hi, Where do you call this procedure ? Quote
delagoutte Posted September 8, 2017 Author Posted September 8, 2017 i call in the on framecreate. I try this procedure SetMenuItemImg(aFrame : TUniframe;aMenuItem : TUniMenuItem; aSvg : string); begin UniSession.AddJS(aFrame.Name+'.'+aMenuItem.Name+'.setIconCls("'+UniMainModule.MainColorClass+' fs16 '+aSvg+'");'); end; but it is not working. in console : MyFrameName is undefined. so it is the reason that i try to access to jsname or jsid because they would be unique. Quote
Sherzod Posted September 8, 2017 Posted September 8, 2017 Hi, Can you try this ?!: procedure TUniMenuFrame.UniFrameCreate(Sender: TObject); begin Self.OwnerWebForm.JSInterface.JSAddListener('boxready', 'function(me){me.owner.'+ Item11.Name +'.setIconCls("testIcon")}'); end; Best regards, Quote
delagoutte Posted September 8, 2017 Author Posted September 8, 2017 no error in console but it don't work Quote
GerhardV Posted September 8, 2017 Posted September 8, 2017 You probably can't do it OnCreate as the frame might not be defined yet as it it is still in the constructor, probably needs to move the responsibility to the owner form where you know the frame has been created. (hence after create) Quote
Sherzod Posted September 8, 2017 Posted September 8, 2017 Try this: procedure TUniMenuFrame.UniFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName='_ready' then begin UniSession.AddJS(Params.Values['_nm'] + '.owner.' + Item11.Name + '.setIconCls("testIcon")'); end; end; procedure TUniMenuFrame.UniFrameCreate(Sender: TObject); begin ClientEvents.ExtEvents.Add('boxready=function boxready(sender, width, height, eOpts){ajaxRequest(sender, "_ready", ["_nm="+sender.nm])}'); end; 1 Quote
delagoutte Posted September 8, 2017 Author Posted September 8, 2017 thanks a lot.this method work Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.