delagoutte Posted August 8, 2017 Share 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 Link to comment Share on other sites More sharing options...
Sherzod Posted August 8, 2017 Share 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 Link to comment Share on other sites More sharing options...
delagoutte Posted August 8, 2017 Author Share Posted August 8, 2017 Thanks a lot again. of course it's working Quote Link to comment Share on other sites More sharing options...
delagoutte Posted September 7, 2017 Author Share 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 Link to comment Share on other sites More sharing options...
Sherzod Posted September 7, 2017 Share Posted September 7, 2017 Hi, Where do you call this procedure ? Quote Link to comment Share on other sites More sharing options...
delagoutte Posted September 8, 2017 Author Share 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 Link to comment Share on other sites More sharing options...
Sherzod Posted September 8, 2017 Share 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 Link to comment Share on other sites More sharing options...
delagoutte Posted September 8, 2017 Author Share Posted September 8, 2017 no error in console but it don't work Quote Link to comment Share on other sites More sharing options...
GerhardV Posted September 8, 2017 Share 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 Link to comment Share on other sites More sharing options...
Sherzod Posted September 8, 2017 Share 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 Link to comment Share on other sites More sharing options...
delagoutte Posted September 8, 2017 Author Share Posted September 8, 2017 thanks a lot.this method work Quote Link to comment Share on other sites More sharing options...
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.