CTreeView Sample

Hi,

In the attachment, i've put two samples of use of the component CTreeview ( standard and async).

Hoping it can help someone :)

I'm only not sure about my implementation of the callback in the async part but I didn't saw any other way to return data :



public function actionTreeFill()


{


     [...]


      echo CTreeView::saveDataAsJson($dataTree);


}


What you did is good. Thanks for the tip.

This attachment is not available anymore?

<bump>

If someone has this file, could they please attach it here. Thanks.

I think it’s this one. Had to repack it. I probably just ran it once to find out what it is.

/Tommy

thank you, very useful!

Brilliant. Thanks a lot.

I changed this to:


echo json_encode($dataTree);

Thanks man.

I forgot. I put this on github

https://github.com/auxbuss/yii-CTreeView-example

Thank you so much!

I have this table:

CREATE TABLE "ADMIN"."ACCOUNT_TYPE_101"

( "ACCOUNT_TYPE_UID" NUMBER PRIMARY KEY,

"ACCOUNT_TYPE_PARENT_UID" NUMBER,

"DESCRIPTION" VARCHAR2(100 BYTE),

)

ALTER TABLE "ADMIN"."ACCOUNT_TYPE_101"

ADD CONSTRAINT "ACCOUNT_TYPE_101_BK__FK1" FOREIGN KEY ("ACCOUNT_TYPE_PARENT_UID")

REFERENCES "ADMIN"."ACCOUNT_TYPE_101" ("ACCOUNT_TYPE_UID") ENABLE

And it has this data:

ACCOUNT_TYPE_UID ACCOUNT_TYPE_PARENT_UID DESCRIPTION


1 NULL ASSETS

2 NULL LIABILITIES

3 NULL EQUITY

4 NULL INCOME

5 NULL EXPENSES

6 1 Current Assets

7 6 Cash

How can i implement this using CTreeview?

Thanks in advance…

You are an angel. Thanks for the data formatter. You got yourself a friend. :)