Yii Framework Forum: Extension Nestedtree - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Extension Nestedtree Complex solution to handle Nested set in tree view Rate Topic: -----

#1 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 10 December 2012 - 08:36 AM

new extension publication in progress...

http://www.yiiframew...ion/nestedtree/

Waiting for your bug reports or any question concentrated nested set in tree.
0

#2 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 10 December 2012 - 06:17 PM

looks good ...
Hey Ho !
Let's go !
0

#3 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 11 December 2012 - 02:57 AM

View Postluc, on 10 December 2012 - 06:17 PM, said:

looks good ...

Thanks!
Just The last check of codes, and version 1.0 is going to be published, hopefully today, or tomorrow.
0

#4 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 11 December 2012 - 09:36 AM

> Thank you for your patient! Extension is tested, and you can download it !
0

#5 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 11 December 2012 - 11:09 AM

I will give it a try ...
Thank you
Hey Ho !
Let's go !
0

#6 User is offline   yiqing95 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 592
  • Joined: 27-December 10
  • Location:china

Posted 11 December 2012 - 11:44 AM

actually i 'v used these two extension a long time(before the yii danyTree extension came out) look at this jdynaTree . :lol:
they can go together well. and i also use my jcontextMenu . so it is absolutely possible three extension go together !

drag and drop to do the ordering . with context menu you can add child ,delete child ,refresh a node ...
1

#7 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 11 December 2012 - 01:34 PM

View Postyiqing95, on 11 December 2012 - 11:44 AM, said:

actually i 'v used these two extension a long time(before the yii danyTree extension came out) look at this jdynaTree . :lol:
they can go together well. and i also use my jcontextMenu . so it is absolutely possible three extension go together !

drag and drop to do the ordering . with context menu you can add child ,delete child ,refresh a node ...


Thanks for your good impression!

I found a good sample in dynaTree example browser to use context menu together with them.

In the center of developing my own extension was using dynaTree with nested set model together in the easiest way.

I collect every other impression for next improvement of this extension, and the context menu inplementation will be the first!
0

#8 User is offline   waterloomatt 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 545
  • Joined: 09-April 10

Posted 12 December 2012 - 10:01 AM

I was having some trouble getting the ControllerMap to find the built in controller/action and I found this to help - especially in localhost environment where the app usually resides in a sub folder. Maybe this could be built into the extension?


<?php
$this->widget('ext.NestedDynaTree.NestedDynaTree', array(
    ...
    'ajaxController' => Yii::app()->baseUrl . '/AXtree/'
));
?>

Matt
0

#9 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 12 December 2012 - 11:14 AM

View Postwaterloomatt, on 12 December 2012 - 10:01 AM, said:

I was having some trouble getting the ControllerMap to find the built in controller/action and I found this to help - especially in localhost environment where the app usually resides in a sub folder. Maybe this could be built into the extension?


<?php
$this->widget('ext.NestedDynaTree.NestedDynaTree', array(
    ...
    'ajaxController' => Yii::app()->baseUrl . '/AXtree/'
));
?>

Matt



Thanks for your report and the good suggestion of the solution!
I used online test enviroment only, and didn`t test this extension on localhost enviroment.

I collect some more impressions, issues and improvement suggestion to publicate next relase of nestedtree extension, but your suggestion will be mentioned in the extension documentation.
0

#10 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 24 December 2012 - 05:41 AM

Hi,
after playing a bit:

1/ error on creating a new "page":

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name_UNIQUE'. The SQL statement executed was: INSERT INTO `page` (`root`, `lft`, `rgt`, `level`) VALUES (:yp0, :yp1, :yp2, :yp3)


request was: AXtree/insert with
POST parameters: model:Page, source:1,mode:after,YII_CSRF_TOKEN:e18e6f2f74194bb26c8f5f55d3a228352cb25a2b

However, an empty page is created ...

2/ can get the multi roots feature of NestedSetBehavior to work ... (I think that AxController load action is repsonsible of that, didn't have the time to investigate it further)

3/ drag'n'drop work like a charm: good work


My suggestion:
use context menu for node creation and deletion. And keep on the good work :D

Thank you
Hey Ho !
Let's go !
0

#11 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 25 December 2012 - 04:48 AM

Hi Luc,
Thank you for your time, and help!

First error is came form the unique name value of the model.

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name_UNIQUE'. The SQL statement executed was: INSERT INTO `page` (`root`, `lft`, `rgt`, `level`) VALUES (:yp0, :yp1, :yp2, :yp3)


This is handled normally in the model, like here:

    
public function beforeSave() {
        if ($this->isNewrecord) {

            $this->name = $this->getNextMaxValue('name', "new_");
         }
        $this->datum_create = new CDbExpression('NOW()');
        return parent::beforeSave();
    }

The getNextMaxValue() function is implemented both NestedTreeActiveRecord and NestedTreeBehavior.

It sould be better - in the next version - put the neme getNextMaxValue function into the AXController.
    public function actionInsert() {

        if (($modelClass = $this->getModel()) !== false) {
            $target = $modelClass::model()->findByPk($_POST['source']);
            $node = new $modelClass;
            $node->{$node->titleAttribute}=$node->getNextMaxValue($node->titleAttribute, "new_");
....
         


2. hasManyRoots
Thank to NestedSetBehavior it works, but:
  • you should mannualy insert root in db
  • you cannot delete any root from tree yet.

next version will handle this issues.

3. Drag and drop

Thanks! It was the main aim of the game!


Suggesion: Context menu

It is in the list for next version... ( include new root function :) )

Next version
The next version will be relased in the next year.

If it is not so big problem, I'll ask you that time to playing a bit with the new version!

Thanks at all!


András
0

#12 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 25 December 2012 - 10:17 AM

thank you for your efforts.
Merry CHristmas.
Hey Ho !
Let's go !
0

#13 User is offline   Algebris 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 01-April 10

Posted 05 January 2013 - 12:32 AM

Hi,
first of all it's a pretty nice starting and i wish you good luck!
i've just playing with this extension and my question is how to set the name of node?
when i add a new one it's become with an empty title.

thanx!
0

#14 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 05 January 2013 - 05:13 PM

View PostAlgebris, on 05 January 2013 - 12:32 AM, said:

Hi,
first of all it's a pretty nice starting and i wish you good luck!
i've just playing with this extension and my question is how to set the name of node?
when i add a new one it's become with an empty title.

thanx!

Hi Algebris,
Thanks for your words.
The new version is on the road, and there will be a prompt to get name of the node before adding it.
The title of the node is normally a Model responsibility.

There is a function in NestedTreeActiveRecord - getNextMaxValue() - to increment a title name if the title field in the model is unique.

In the AXController actionInsert() method you can define the value of the title field of the node too.

I hope I could help!

András
0

#15 User is offline   Ray Kwok 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 14-October 09

Posted 22 January 2013 - 04:36 AM

Hi,
how to edit the name of each new record?
0

#16 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 22 January 2013 - 08:48 AM

View Post锐 子, on 22 January 2013 - 04:36 AM, said:

Hi,
how to edit the name of each new record?



In this version you can edit name and any other fields via normal CRUD form.

Set the clickAjaxLoadContainer property to your existing HTML element
<div id='content'></div>


and set clickAction property to your update Action in the CRUD controller (/Cathegories/update/).

See Usage:
/
<?php
        $this->widget('ext.NestedDynaTree.NestedDynaTree', array(
            //the class name of the model.
            'modelClass' => "Cathegories",
            // action taken on click on item. (default empty)
            'clickAction' => "/Cathegories/update/",
            //if given, AJAX load a result of clickAction to the container (default empty)
            'clickAjaxLoadContainer' => 'content',
            //can insert, delete and ( if enabled)drag&drop (default true) 
            'manipulationEnabled' => !Yii::app()->user->isGuest,
            //can sort items by drag&drop (default true)
            'dndEnabled' => true,
 
            //AJAX controller absolute path if you don`t use controllerMap
            // 'ajaxController'=>'/path/to/controller/' //default('/AXtree/')
        ));
        ?>



New version is going to release in February, 2013

I integrated one-click-editor to the extension.
0

#17 User is offline   igortxu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 05-February 13

Posted 05 February 2013 - 03:58 PM

Hi,
is it possible with your widget bot only to sort nodes but to rearrage them?
I mean, can I drop a node into anotther simple one to turn it into his child?

Thanks!
0

#18 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 05 February 2013 - 06:23 PM

View Postigortxu, on 05 February 2013 - 03:58 PM, said:

Hi,
is it possible with your widget bot only to sort nodes but to rearrage them?
I mean, can I drop a node into anotther simple one to turn it into his child?

Thanks!

Hi,
Yes the widget has drag and drop capability, and you can rearrange items, drop to item to another as it's child,
according to the normal behavior of Nested set.
0

#19 User is offline   Szincsák András 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-June 11
  • Location:Hungary, Győr

Posted 05 February 2013 - 06:35 PM

The Next version has been delayed by the jquery.contextmenu plugin strange behavior.
Today I found a solution of the context menu problem. It was big deal, and I fount a very good documentation for context menu.

I share, it could be useful:
http://www.timgittos...bind-click-fix/

I'm collecting more bugs, and ideas of improvement nesetedTree extension, and the next version will be published soon.
0

#20 User is offline   yonghan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 28-January 13

Posted 19 February 2013 - 07:03 AM

Hi,thanks for the great extension.i have followed the instruction,when i try to show it on the page,it gives me load error.i used your controller and your extended activerecord too.thanks
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users