tags:

views:

103

answers:

3

I am using following PHP class to display records. I also want to open another webpage when a row is selected according to a column value. This class is doing everything fine when this line is like:

$x->setQuery("*", "people");

If instead of *, I define columns like:

$x->setQuery("fname,lname,age", "people");

it stops identifying the clicked row id. Can someone help me out?

http://www.eyesis.ca/projects/datagrid.html

Please check the Example: 4 demo and source supplied there.

+2  A: 

I'm not really familiar with this library, but I've had a peek at the source. I think you need to include the id column in the list of columns you pass to setQuery. You'd probably have the best results calling it like this:

$x->setQuery("id,fname,lname,age", "people", "id");

You could also try leaving it out of the first list, but still passing it as the third parameter which specifies the primary key.

garethm
A: 

The eyesis thing looks interesting. It is unfortunate they don't have API docs, say by running the code through phpdoc. The row selector piece, in the source code for example 4, just says

$x->addRowSelect("alert('You have selected id # %Id%')");

Shooting in the dark, I would try

$x->addRowSelect("alert('You have selected fname # %fname%')");

possibly capitalizing %Fname%.

If that didn't work, I'd reset that line with %Id%, and add id to the query

$x->setQuery("id,fname,lname,age", "people");

Again, docs would help me decide what the capitalization convention is.

Ewan Todd
A: 

Quiero que la al selecionar una fila c guarde el Id de la columna en una variable.... ¿como puedo hacerlo?

carlos