[EXTENSION] CjsTree

Hi,

I’ve just developed a widget for the jsTree, a CTreeView enhancement.

Download the jstree component from their website (http://www.jstree.com) and extract it under protected/extensions/jsTree.

Then download attached CjsTree.php under the folder, just like install.jpg.

And read the documentation page.

Plz, could you put it on the extensions page?

[grump]

The attachments and links in the forum are a bit broken… Is there any way to fix them?

[/grump]

ironwolf,

I’ve uploaded it as a jsTree on the extension page, but there are some errors in documentation.

Though I tried several ways to fix it using the Markdown syntax, I cannot figure it out how it can displays the HTML tags as itself.

If somebody let me know the correct way to display the HTML tags in the documentation, I will fix it.

thx man

When I download the extension from the extension page I get the error that the archive is corrupt. (I tried it using tar/gzip on ubuntu and WinRAR on windows.

Does anyone have the same problem?

works fine for me (winRar on window$ ;) )

B)

Thanks Raoul, I tried it on a third computer today and it seems to work now… :)

I think this problem come from your internet broswer…

I have a error of corrupted file with any extensions i have downloaded with IE 7. I have to download it with Firefox and is work after that.

Could you please bundle a working example with this, since trying to follow your truncated directions is impossible.

PS. The download file is weird. I had to extract it, then rename the extracted file which was without an extension to file.tgz and extract it again.

Backslider,

To make it simple, just add an actionTree1() to your working controller and add a views/your-controller-view-folder/tree1.php file, which is explained in the documentation Case 1: using HTML.

If you want to display a hierarchical database table, you need the nestedset extension.

Read the nestedset documentation carefully, and set up your database then follow my documentation Case 2: using database table.

Good luck.

PS: I’ve just uploaded a new tar file.

Thanks Shocky. I got it going ok myself (with nested set), however for newbies its gonna be difficult.

the jsTree extendsion can support jsTree v.0.9.9a?

To use jsTree v.0.9.9a you need to modify CjsTree::init() method, this is my version:




    public function init()

    {

        if(isset($this->htmlOptions['id']))

            $id=$this->htmlOptions['id'];

        else

            $id=$this->htmlOptions['id']=$this->getId();

        if($this->url!==null)

            $this->url=CHtml::normalizeUrl($this->url);


        $dir = dirname(__FILE__).DIRECTORY_SEPARATOR.'source';

        $this->baseUrl = Yii::app()->getAssetManager()->publish($dir);


        $cs=Yii::app()->getClientScript();

        //$cs->registerScriptFile($this->baseUrl.'/jquery.tree.js');

        $cs->registerScriptFile($this->baseUrl.'/jquery.tree.min.js');


        // jstree should make this automatically (see line 211),  

        // but this does not work if script is loaded

        // dynamically with renderPartial into jQuery/UI dialog

        if (!isset($this->options['ui'])) $this->options['ui'] = array();

        if (!isset($this->options['ui']['theme_name'])) $this->options['ui']['theme_name'] = 'default';

        if (!isset($this->options['ui']['theme_path'])) $this->options['ui']['theme_path'] = 

             $this->baseUrl.'/themes/'.$this->options['ui']['theme_name'].'/style.css';


        $options=$this->getClientOptions();

        $options=$options===array()?'{}' : CJavaScript::encode($options);

        $cs->registerScript('Yii.CJsTree#'.$id,"$(function () { $(\"#{$id}\").tree($options); });");

        if($this->cssFile !== null && $this->cssFile !== false)

            $cs->registerCssFile($this->cssFile);

    }




Seb,

i am getting the following error

include(CJavascript.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

can anybody help me with this…

Try to change "CJavascript::encode" to "CJavaScript::encode"

Thanks, but Theme Images not showing :mellow:

To get this file i used wget to downloaded it and worked.

Set it up and the big trouble began. The main problem is that when i try to use variable TREE_OBJ in the callbacks ( either in alert or try to use it’s method ) nothing happens. After debugging with firebug i see that the TREE_OBJ has value false instead of object params.

Finally, is this extension left to it’s faith? Will there be any more contribute to it?

Friendly,

dmtrs

Hi All,

I am newbie, please help me, anchor tag is not clickable[not taking me to the URL]

please find below the code




<ul>

	<li class="open">

		<a href="subgroup_9/" class="">Sub Group3 . 1</a>

			<ul>

				<li class="leaf"><a href="test_10/index.php" class="clicked">Test10</a></li>

				<li class="leaf"><a href="test_11/index.php" class="">Test11</a></li>

				<li class="leaf"><a href="test_12/index.php" class="">Test12</a></li>

				<li class="last leaf"><a href="test_13/index.php" class="">Test13</a></li>

			</ul>

	</li>

	<li class="last closed">

		<a href="/subgroup_10/">Sub Group3 . 2</a><br/>

		<ul>

			<li class="leaf"><a href="test_14/index.php">Test14</a></li>

			<li class="last leaf"><a href="test_15/index.php">Test15</a></li>

		</ul>

	</li>

</ul>



Even if anchor tag has an url like "test_10/index.php", onClicking on that anchor text it is not going to the specified URL, please tell me how can I make this work

it didnt worked with me =/ when i try to use the code example of the program it shows {"type":"json","async":true,"opts":{"method":"GET","async":true,"url":"http:\/\/www.jstree.com\/demos\/async_json_data.json"}}