TreeConnector and NULL values for parent_id

Hello,

I’ve noticed in my TreeConnector tests, that the top items in a tree must have the parent_id set to 0 like this :

id parent_id code
1  0         A
2  0         B
3  1         A1
4  3         A11
5  0         C

In my database, the top items doesn’t have a parent_id, like this :

id parent_id code
1  NULL      A
2  NULL      B
3  1         A1
4  3         A11
5  NULL      C

In this configuration, TreeConnector doesn’t works (no data returned).

Is there a way to tell TreeConnector that my db use NULL values instead 0 values when there’s no parent_id ?

Thanks for your help :slight_smile:

@++
JC

In code of treegrid connecto there is a next method

	public function parse_request(){
		parent::parse_request();
		
		if (isset($_GET["id"]))
			$this->request->set_relation($_GET["id"]);
		else
			$this->request->set_relation("0");
			
		$this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode
	}

So you can define $_GET[‘id’] before calling connector’s code to use any other value as starting parent id ( not quite sure about null - it is not a number value, so it may not work in such way )

Hello,

yes, it doesn’t work.

If I put $_GET["id"] = "NULL"; before calling connector, there’s no result neither.

In the log :

SELECT id, parent_id, code FROM tree WHERE parent_id = 'NULL'

The only SQL code valid should be :

SELECT id, parent_id, code FROM tree WHERE parent_id isnull

Any idea ?

Thanks for your help

@++
JC