hl5
Posts: 2
|
| Posted: 09/15/2005, 8:53 AM |
|
Hello:
I created an editable grid with CCS.
Now I'd like to be able to change the table on which the grid is composed.
I've identified three files which require the table name be changed for it to work. I've done so on a manual basis and it works.
I would like to have the user click a link and for the grid to auto-update with the new table name's data.
Any ideas on how to effect this?
Many thanks,
- Harry
|
 |
 |
DonB
|
| Posted: 09/18/2005, 6:51 PM |
|
In the before build select event, change the SQL property to have the
desired table name:
$myGrid->ds->SQL = "SELECT * FROM " . CCGetParam("table","defaulttable");
Your names will vary, but the pattern is valid. It retrieves a parameter
named 'table' from the query parameters (URL string) and alters the SQL
property to be the specified table. Where the parameter is not provided, I
default to 'defaulttable' as the name.
Alternately, you could pass a parameter value like 1,2,3, etc. and use a
switch() statement to select a table name that way.
--
DonB
http://www.gotodon.com/ccbth
"hl5" <hl5@forum.codecharge> wrote in message
news:5432998e16d5cc@news.codecharge.com...
> Hello:
>
> I created an editable grid with CCS.
> Now I'd like to be able to change the table on which the grid is composed.
> I've identified three files which require the table name be changed for it
to
> work. I've done so on a manual basis and it works.
> I would like to have the user click a link and for the grid to auto-update
with
> the new table name's data.
>
> Any ideas on how to effect this?
>
> Many thanks,
>
> - Harry
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Harry
|
| Posted: 09/19/2005, 9:09 AM |
|
Hello DonB:
Thanks for your response.
I am new to CCS and am not quite sure how to implement your solution.
I attempted to put the Before Build Select into the NewPage1_events.php, literally.
It did not work.
Is there a tutorial that might illustrate your solution for me.
Thanks,
- Harry
|
|
|
 |
Harry
|
| Posted: 09/19/2005, 9:41 AM |
|
Hello DonB:
I am pasting the code and where it was placed in the events file:
//Custom Code @42-F0EF6B18
// -------------------------
global $alabama;
// Write your own code here.
$myGrid->ds->SQL = "Select * From " . CCGetParam("table","california");
// -------------------------
//End Custom Code
I am not sure how $myGrid is named.
For "table", should I pass a $_Get(table) to get a URL parameter?
Thanks,
- Harry
|
|
|
 |
hl5
Posts: 2
|
| Posted: 09/19/2005, 9:57 AM |
|
When running Live Page after placing:
//Custom Code @42-F0EF6B18
// -------------------------
global $alabama;
// Write your own code here.
$alabama->ds->SQL = "Select * From " . CCGetParam("california","california");
Result is:
Generating "NewPage1"
Warning: Record : Event BeforeBuildSelect can not have actions because datasource would not be generated.
Not sure what that means, too.
Looking for any ideas.
Thanks,
- Harry
|
 |
 |
|