This topic is locked

TreeView or ListView

8/26/2009 3:26:22 PM
PHPRunner General questions
gps088 author

Hello,

I would like to use a treview or listview but I really don't know how to do that.
I have a table with the next structure:
CREATE TABLE ContactsClassification (

ClassificationID int(10) NOT NULL auto_increment,

ClassificationName varchar(100) collate latin1_general_cs NOT NULL,

ClassificationID_parent int(10) NOT NULL default '1',

PRIMARY KEY (ClassificationID)

) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs;
Some records in this table:
ClassificationID ClassificationName ClassificationID_parent

1 Top Level 1

2 Embajada de México 3

3 Embajadas 1

4 Embajada de Argentina 3

5 Embajada de El Salvador 3

6 Embajador 1

7 Gobierno de Canadá 1

8 Bibliothèque du Parlement / Library of P 7

9 Patrimoine Canadien/Canadian Heritage 7
I woule like to show the information like this:
ClassificationID ClassificationName ClassificationID_parent

1 Top Level 1

3 Embajadas 1

2 Embajada de México 3

4 Embajada de Argentina 3

5 Embajada de El Salvador 3

6 Embajador 1

7 Gobierno de Canadá 1

8 Bibliothèque du Parlement / Library of P 7

9 Patrimoine Canadien/Canadian Heritage 7
In the treview or listview should show in the first the parent after that the childs
somebody could help me, please

I am using phprunner 5.1.2503
thank you

J
Jane 8/27/2009

Hi,
you can do the following:

  1. create two custom views on the Datasource tables tab and edit SQL queries for these views on the Edit SQL query tab.

    Here is a sample:

select `ClassificationID`,

`ClassificationName`,

`ClassificationID_parent`

from `ContactsClassification`

where `ClassificationID_parent`=1



and

select `ClassificationID`,

`ClassificationName`,

`ClassificationID_parent`

from `ContactsClassification`

where `ClassificationID_parent`!=1


2. then set up master-detail relationships between these views on the Datasource tables tab.

gps088 author 8/28/2009



Hi,
you can do the following:

  1. create two custom views on the Datasource tables tab and edit SQL queries for these views on the Edit SQL query tab.

    Here is a sample:

select `ClassificationID`,

`ClassificationName`,

`ClassificationID_parent`

from `ContactsClassification`

where `ClassificationID_parent`=1



and

select `ClassificationID`,

`ClassificationName`,

`ClassificationID_parent`

from `ContactsClassification`

where `ClassificationID_parent`!=1


2. then set up master-detail relationships between these views on the Datasource tables tab.


thx
the information i would like to show the listview like a combobox because the user needs to select 1 row in the listview but needs to know how the levels are.
thank you