Difference between #4 and #5 of
Display an AJAX tree from your DB using CTreeView

Revision #5 has been created by Orteko on Oct 17, 2010, 10:07:46 AM with the memo:

Add AJAX tag
« previous (#4) next (#10) »

Changes

Title unchanged

Display an AJAX tree from your DB using CTreeView

Category unchanged

Tutorials

Yii version unchanged

Tags changed

AJAX

Content unchanged

[...]
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://projects.ourplanet.tk/node/100)
19 0
21 followers
Viewed: 59 828 times
Version: 1.1
Category: Tutorials
Written by: François Gannaz
Last updated by: François Gannaz
Created on: Apr 7, 2010
Last updated: 6 years ago
Update Article

Revisions

View all history