Revision #4 has been created by rainyjune on Oct 9, 2010, 6:20:41 AM with the memo:
update Chinese version link
« previous (#3) next (#5) »
Changes
Title
unchanged
Display an AJAX tree from your DB using CTreeView
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Content
changed
[...]
When sending the JSON-encoded result, there's a little trick: the javascript wants the `hasChildren` attribute to be a boolean. But the SQL result just contains 0 or 1, so we have to convert it, at least for the "false" case. Instead of operating on the string result, one could modify the PHP array with a `foreach`.
The `exit()` might not be necessary, but if you enabled the logs to Firebug, then Yii will write some JS at the end of your response, and it will break your AJAX.
### Links
[Chinese version](http://dreamneverfall.cnprojects.ourplanet.tk/node/100)