Yuri
|
| Posted: 09/20/2004, 11:16 AM |
|
Hi,
I have a page with 9 different grids/forms.
Dipending on the selected item form the menu only 2 -3 grids become visible.
I turned on the Debug for MySql and to my horror ALL SQL statements are executed each time regardless the visibility of grids and forms.
How do I make them NOT to execute if controls are not visible?
Thank you.
|
|
|
 |
johny_f
Posts: 23
|
| Posted: 09/20/2004, 11:30 AM |
|
I quess you mean all "custom" sql statements (like after insert etc.)
in this case is good to yous the same "IF" condition as you use for showing/hiding grid or form.
E.G. IF ($a == 1) { $formname->Visible = True;
$run SQL...
}
else { hide form and do not run SQL}
...
Hope this help.
_________________
Johny_f |
 |
 |
johny_f
Posts: 23
|
| Posted: 09/20/2004, 11:32 AM |
|
BTW, showing/hiding "controls" like listbox or textbox in the record form is counted into execution even it is set as Visible = False. (As far as I have experienced).
_________________
Johny_f |
 |
 |
klw
|
| Posted: 09/20/2004, 12:41 PM |
|
Have you also tried setting the following properties
to false for each of your grids which are no longer visible?
UpdateAllowed
InsertAllowed
DeleteAllowed
ReadAllowed
Quote Yuri:
Hi,
I have a page with 9 different grids/forms.
Dipending on the selected item form the menu only 2 -3 grids become visible.
I turned on the Debug for MySql and to my horror ALL SQL statements are executed each time regardless the visibility of grids and forms.
How do I make them NOT to execute if controls are not visible?
Thank you.
|
|
|
 |
Yuri
|
| Posted: 09/20/2004, 1:16 PM |
|
Thank you Johny,
I'm dealing with both custom and build-in SQL.
I, probably, do not understand function Show() correctly.
It looks like if the Grid is not Visible it will not suppose to call function Open() but is does...
function Show()
{
global $Tpl;
if(!$this->Visible) return;
$ShownRecords = 0;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->ds->Prepare();
$this->ds->Open();
|
|
|
 |
Yuri
|
| Posted: 09/20/2004, 1:19 PM |
|
klw,
I use simple grids and search forms and they do not have these properties.
|
|
|
 |
DonB
|
| Posted: 09/20/2004, 3:54 PM |
|
The key is "when" you set them invisible. Controls set Not Visible in the
Page Before Show event do not query their data source. The event sequence
is such that the data is fetched before the control's visibility is
evaluate. So, setting Visible to False in the control's Before Show is too
late to prevent the fetch.
I pointed this out to Yes prior to version 2.0. It's not clear to me if
this was an oversight or if there was some reason they implemented it that
way. I'm not certain that the above is true for all platforms, but it is
for ASP and PHP. There might be cases where you need some data access, but
not the visible control, so I suppose I can rationalize that the way it's
currently designed was intentional.
--
DonB
http://www.gotodon.com/ccbth
"Yuri" <Yuri@forum.codecharge> wrote in message
news:5414f1e859a69f@news.codecharge.com...
> Hi,
> I have a page with 9 different grids/forms.
> Dipending on the selected item form the menu only 2 -3 grids become
visible.
> I turned on the Debug for MySql and to my horror ALL SQL statements are
> executed each time regardless the visibility of grids and forms.
>
> How do I make them NOT to execute if controls are not visible?
>
>
> Thank you.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Yuri
|
| Posted: 09/21/2004, 12:20 PM |
|
Thank you Don,
we already moved our code into Page AfterInitialize event and it worked.
Page Before Show event should work also.
We'll try it for a different page.
(I also raised a ticket and tech support suggested Page AfterInitialize event)
It would be good if Yes consider including this info into CCS Help file.
It took ~30 minutes for us to examine CCS code & find the solution.
Thanks again.
|
|
|
 |