开发者

[PHP]: Can someone help me fix this DataGrid class?

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 supp开发者_StackOverflowlied there.


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.


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.


How do you link two tables in the $x->setQuery, (example) I have $x->setQuery("*", "applicant inner join suritee on applicant.app_trn=suritee.app_trn","app_trn"); In this case applicant is the parent table with a primary key of app_trn and suritee is the child with a foreign key of app_trn

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜