ecsMike
Posts: 40
|
| Posted: 06/22/2009, 11:06 AM |
|
I am developing an application in CCS 4.2 using PHP. The application includes an Editable Grid. I need to be able to determine the row number in the Before Show Row event. According to the few posts I could find, there is no supported Datasource property to access for that information. One post (from about 4 years ago) indicated support had advised him that he needed to put a custom row counter in the Before Show Row event but after hours of effort I cannot find a way to do it.
I would appreciate any assistance I can get in this matter. The least desirable method would be to have any sort of hidden control in the grid. A global or Session variable would be far better for this application.
Thanks . . . Mike
|
 |
 |
datadoit
|
| Posted: 06/22/2009, 2:33 PM |
|
Mike, see if this helps... http://forums.codecharge.com/posts.php?post_id=60507
|
|
|
 |
ecsMike
Posts: 40
|
| Posted: 06/22/2009, 3:31 PM |
|
Thank you so much!!! Yes, I think this will help immensely.
Mike
|
 |
 |
ecsMike
Posts: 40
|
| Posted: 06/22/2009, 4:38 PM |
|
While that helped I am still have a great deal of difficulty with global variables. If I set a global variable in the white space of the Events.php file (just below //End BindEvents Method like this:
$xvar = 1;
And then in a later function like Before Build Select include:
global $xvar;
$xvar = 10;
And then in another function like Before Submit I include:
global $xvar
$xvar += 1;
echo($xvar);
the value echoed is 2 not 11. So, despite the global definition and the global $xvar statements in the Functions, $xvar is readable as a global variable but is treated as a local variable when the value is changed.
I have spent nearly all day reading Forum posts, PHP documentation, etc. and cannot figure this out.
Advice would be greatly appreciated.
Mike
and then
|
 |
 |
datadoit
|
| Posted: 06/22/2009, 8:22 PM |
|
Are you declaring your variable global before defining it? Such as:
global $xvar;
$xvar = 1;
|
|
|
 |
ecsMike
Posts: 40
|
| Posted: 06/23/2009, 12:54 PM |
|
Yes I am. I still have not figured it out. The global variables are accessible in all functions in Events.php but I cannot change them in some. I will post a list of the problem ones soon.
Thanks very much for your help . . . Mike
|
 |
 |
datadoit
|
| Posted: 06/23/2009, 3:21 PM |
|
Yeah, now that I think about it a lil' more, you're probably best just
putting in a hidden control and setting it's default value in the grid's
BeforeShow and then incrementing it in the BeforeShowRow.
Note that this will only increment for shown records in the grid, not
all records in the result set.
|
|
|
 |