Page 1 of 2

New Event (OnBeforeOpen)

PostPosted: 18 Apr 2016 16:12
by MCarver
CG Gurus,

Is there any chance of getting the new event "OnBEFOREOpen" for the TIWCGJQDialogEx? I have a consistent need to fill Combo;/ DropDowns for the DialogEx, but I find that the current OnOpen event is too late, and that the Combo/DropDowns are not filled as hoped for. I consistently use the DialogEx as a grid editor, where I make the DialogEx visible with a registered CallBack event. Of course you might suggest filling these Combo/DropDowns within the CallBack. My challenge, is that I have created a single generic CallBack, which is used my nearly 30 grids, Because of this approach I am seeking an alternative way to prepare the unique requirements for each DialogEx.

Please consider adding this event.

Regards,
Monte Carver

Re: New Event (OnBeforeOpen)

PostPosted: 18 Apr 2016 21:18
by George
Hello!
Use OnCreate event or combobox.ajaxrerender after fill code.

Re: New Event (OnBeforeOpen)

PostPosted: 20 Apr 2016 17:32
by MCarver
After pondering a few days, neither of the suggest approaches will work for my needs. Its not that filling the various comboboxes, DropDowns etc won't occur. But for speed purposes, I only want them filled WHEN a given dialog box is opened. The OnCreate and OnRender events happen regardless of whether the DialogEx is opened or not. This causes the page to render slowly..

So, again. Plz consider my request,

Regards,
Monte Carver

Re: New Event (OnBeforeOpen)

PostPosted: 20 Apr 2016 17:50
by Alexander Bulei
Hi MCarver,

I only want them filled WHEN a given dialog box is opened.


Hm...you mean when visible? if yes, so there is only one event: OnOpen

Best Regards.

Re: New Event (OnBeforeOpen)

PostPosted: 20 Apr 2016 20:12
by MCarver
Alexander,

Thanks for the quick reply. Your response got me thinking. The DialogEx(s) in question are owned by a frame and set to Visible := False in the IWFrameRegionCreate event of the given frame. So, my question, is under this condition, WHY is the OnRender event firing for a given DialogEx? Is this expected? I dont have RenderInvisibleControls = True.

When I do open the DialogEx, I use the following little helper, which is called via Async.

procedure fxVisible(aControl : TIWCustomRegion; aIsVisible: boolean); overload;
begin
if aIsVisible then
begin
if CGIsCallbackProcessing then
RenderRegionAsync( aControl )
else
aControl.Visible := True;
end
else
aControl.Visible := False;
end;

Please advise,

Regards
Monte Carver

Re: New Event (OnBeforeOpen)

PostPosted: 21 Apr 2016 09:31
by Alexander Bulei
Hi MCarver,

I dont have RenderInvisibleControls = True.


Check this property in the parent of frame.
And for the dialogs, use JQDialogOptions.Open

Best Regards.

Re: New Event (OnBeforeOpen)

PostPosted: 21 Apr 2016 21:14
by MCarver
As I said.. All RenderInvisibleControls are set to FALSE. As for using Open... I assume then that I want to use CLOSE as well? What should I set the MyDialogEx.Visible to?

So.. currently I am doing this. Is this the correct approach? And does opening the dialog have any bearing on my other issue (i.e. The IW Session is not processing submit)?

TMyCGFrame.IWFrameRegionCreate(Sender: TObject);
begin
...
dlgModifyMstr.JQDialogOptions.Close();
dlgModifyMstr.Visible := False;

MyAsyncEvent
dlgModifyMstr.JQDialogOptions.Open();
dlgModifyMstr.AjaxReRender();

Re: New Event (OnBeforeOpen)

PostPosted: 26 Apr 2016 10:03
by Alexander Bulei
Hi,

What should I set the MyDialogEx.Visible to?


You don't need setting the Visible property to false/true after calling the Close/Open.

Amd in async event, you don't need to call the AjaxReRender, because methods as Close/Open have async support.

Best Regards.

Re: New Event (OnBeforeOpen)

PostPosted: 18 May 2016 23:13
by ScottWGast
MCarver,

I've found the same issue and have implemented a .Initialize procedure on each of my frames that will (at some point) reside on a modal TIWCGJQDialog. When I get ready to pop up the dialog, I .Initialize the frame beforehand.

HTH,
Scott

Re: New Event (OnBeforeOpen)

PostPosted: 19 May 2016 16:05
by MCarver
Scott,

You have piqued my interest, as I am still fighting this issue. My current approach fails to properly render the CGDropDown, which leaves them empty on the first render of the Dlg.

Could you please paste some code so I can better visualize your approach?

Thank You,
Monte Carver