CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 CCS:How to hide a grid column or form row?

Print topic Send  topic

Author Message
Brent
Posted: 05/21/2002, 9:23 PM

With all the properties in CCS, this should be easy, right?

1) I have a grid column that only the editor should see and should be hidden from
the normal user. Is this possible to do in CCS?

2) Is it also possible to hide a row in a form?

TIA
Nicole
Posted: 05/22/2002, 2:41 AM

Brent,
1. you can create two forms and show/hide them depending on user rights. Create Page After Initialize event:
ASP
if condition_to_hide then
form_name.Visible = false
end if

PHP
global $form_name;
$form_name->Visible = false;

2. you can hide record in grid as well. Solution a little bit tricky. Create Form Before Show Row event that will return any result. Depending on its result show row code will be executed.
Sample event code:
ASP
if Bugs.bug_id.Value = 2 then
Bugs_BeforeShowRow = 0
else
Bugs_BeforeShowRow = 1
end if

PHP
global $Bugs;
if ($Bugs->bug_id->Value == 2)
return 0;
else
return 1;


where "Bugs" in form name and "bug_id" is field name.
But it is not all. Open page code and find Open() function of clsGrid<form)name> class. Find the lines:
ASP
CCSEventResult = CCSEvents("BeforeShowRow")
RowControls.Show
Recordset.MoveNext
ShownRecords = ShownRecords + 1

and modify it to display row depending on CCSEventResult:
CCSEventResult = CCSEvents("BeforeShowRow")
if CCSEventResult = 1 then
RowControls.Show
end if
Recordset.MoveNext
ShownRecords = ShownRecords + 1

PHP
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->bug_id->Show();
$this->bug_name->Show();
$Tpl->block_path = $GridBlock;
$Tpl->parse("Row", true);
$ShownRecords++;
$is_next_record = $this->ds->next_record();

Modify it to get:
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
if ($this->CCSEventResult == 1){
$this->bug_id->Show();
$this->bug_name->Show();
$Tpl->block_path = $GridBlock;
$Tpl->parse("Row", true);
}
$ShownRecords++;
$is_next_record = $this->ds->next_record();


Brent
Posted: 05/23/2002, 7:40 AM

Nicole,
Thanks for the suggestions. I guess the only easy way is to create 2 forms
and hide the unappropriate form. I thought with CCS there would be (should be)
a property where we could say myGrid->columns[2]->visible = false; and that could
would not be generated. Oh well, back to duplicating forms. :(

As for #2, I'm sorry I should have been more explicit. I meant is there a
way to hide a row from a record form. Let's say the record form had the employee's
salary on it "Salary: $52,332" and only the person with group level > 10 should
see it. Otherwise it is hidden. Something like myRecord->rows[2]->visible = false;
would be nice. :) But it looks like I'll have to duplicate some more forms instead. :(

BTW, last week I did recommend something like what you suggested for filtering
rows in a grid in your answer to #2. I would like to see YesSoftware add an
If Statement after the call to BeforeShowRow event to check for a return value.
A "0" returned by this event would skip the current record. A "1" or "" would accept the
record. A "2" would terminate building the grid by exiting the loop. This gives
the developer the ability to use PHP or ASP or other code like lookups to filter
records. What is great about this is it won't break the current code because a
null value returned ("") is the same as a "1", and the record gets accepted.
Nicole
Posted: 05/23/2002, 11:49 PM

Brent,
you cannot hide column or row set column.visible = false due to html code. I mean that each part of html that is displayed depending on any condition (e.g. row with Error messages on the form) are surrounded with html comments which are parsed when code is executed. But row or table cell are generated as plane html without any comments.

The workaround for hiding row in Record form is to display it as field (e.g. as textbox) or as empty table row. In this case as in CC set field type to Label and assign it desired value in field Before Show event.
PHP
global $form_name;
$form_name->field_name->SetValue("<input type = text name = 'test_val' value = '234' >");

CodeCharge Support
Posted: 05/24/2002, 12:10 AM

Brent,
thank you for suggestion. We'll consider this feature for future CCS releases.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.