Giter Site home page Giter Site logo

spark-tree's People

Contributors

kachurovskiy avatar nek avatar stefanklug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spark-tree's Issues

Removing item which causes empty branch makes tree to be invalid state.

Removing item makes tree state invalid. Details are described below

  1. expand all branches
  2. remove last child of an branch

[example]
assume that we have a tree-structured data below:

  • Root
    • Branch 1
      • Branch1-1
      • Branch1_1_1
        • Leaf
    • Branch 2

First, expand all branches and then remove Branch1_1 from Branch1 .

as we expected :

  • Root
    • Branch 1
      • Leaf
    • Branch 2

but actually :

  • Root
    • Branch 1
      • Leaf
        Branch

example code here (https://github.com/kazup0n/Spark-Tree/tree/empty_branch_issue/test/empty_branch_issue/src)

SparkTree does not support stylesheet inheritence for icons

added spark tree namespace to flex 4 css stylesheet... styles such as color, backgroundColor, etc, map fine... disclosureIconClosed and disclosureIconOpen do not. I think this has to do with the if-else statement in the constructor. It checks for mx Tree styles and applies them, otherwise it initializes to defaults, when it should check its own style declaration or apply its own styles after constructor.

Filtering a tree dataprovider results in exception

I resolved the exception by adding

    if(branch == null)
        return;

to the beginning of the removeBranch method. This seems to be a simple fix, albeit it may not be the best solution.

This occurs when I try to filter the tree's dataprovider

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.sparkTree::TreeDataProvider/removeBranch()[D:\Flex Projects\sparkTree\src\com\sparkTree\TreeDataProvider.as:644]
at com.sparkTree::TreeDataProvider/removeLostBranches()[D:\Flex Projects\sparkTree\src\com\sparkTree\TreeDataProvider.as:768]
at com.sparkTree::TreeDataProvider/branch_collectionChangeHandler()[D:\Flex Projects\sparkTree\src\com\sparkTree\TreeDataProvider.as:821]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.collections::ListCollectionView/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1024]
at mx.collections::ListCollectionView/internalRefresh()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1558]
at mx.collections::ListCollectionView/refresh()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:477]
at com.pearson.cpt.views.components::GradeRangeFilter/doFilter()[D:\wwwroot\PearsonCPT\CPTClient\src\com\pearson\cpt\views\components\GradeRangeFilter.mxml:50]
at com.pearson.cpt.views.components::GradeRangeFilter/onFilterItemSelect()[D:\wwwroot\PearsonCPT\CPTClient\src\com\pearson\cpt\views\components\GradeRangeFilter.mxml:60]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]
at spark.components::List/commitSelection()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1205]
at spark.components::List/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1078]
at mx.core::UIComponent/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:8209]
at spark.components::List/item_mouseDownHandler()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1842]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]
at mx.managers::SystemManager/mouseEventHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2924]

TreeDataProvider consider a branch is an Array

The TreeDataProvider class uses item selection by index feature of an array with brackets, on line 709 & 728:

if (branch[i] == item)

It can cause some issue when using custom IList implementation that are not arrays.
I suggest replacing the above code with this:

if (branch.getItemAt(i) == item)

dragMoveEnabled problem

Hello!

First of all, thanks for a very useful component.

I have run into one minor issue. I use dragEnabled, dropEnabled and dragMoveEnabled with the sample to be able to reorder items, but if I want to move the 'Element 0' -> 'Element 2' child item to a place before the toplevel 'Element 1' item, this doesn't seem to work. Is there any way to fix this? Right now, I have to move the 'Element 2' item to the top level, close the 'Element 0' item and then move 'Element 2' below the 'Element 0' item.

Wanted result:
Result

SparkTree does not support doubleClick to chose an item

<sparkTree:Tree id="tree" dataProvider="{dataProvider}"
labelField="{dataProvider is XMLListCollection ? '@Label' : 'label'}"
width="100%" height="100%" textRollOverColor="yellow"
textSelectedColor="0xFFFFFF" dragEnabled="false" dropEnabled="false"
dragMoveEnabled="true" doubleClick="tree_doubleClickHandler(event)">

protected function tree_doubleClickHandler(event:MouseEvent):void
{
// do something
}

when i doubleClick one item ' tree_doubleClickHandler ' method not exec;

SparkTree does not support doubleClick to chose an item

<sparkTree:Tree id="tree" dataProvider="{dataProvider}"
labelField="{dataProvider is XMLListCollection ? '@Label' : 'label'}"
width="100%" height="100%" textRollOverColor="yellow"
textSelectedColor="0xFFFFFF" dragEnabled="false" dropEnabled="false"
dragMoveEnabled="true" doubleClick="tree_doubleClickHandler(event)">

protected function tree_doubleClickHandler(event:MouseEvent):void
{
// do something
}

when i doubleClick one item ' tree_doubleClickHandler ' method not exec;

Scrollbars disappear when resizing tree

Scrollbars on the tree will disappear when resizing the tree beyond a specific point. If I have time, I will investigate further and hopefully submit a fix

Keyboard behavior change

Hi,

The default behavior or left arrow is bit different in windows and mx tree component.

below is the code I change to make it behave like the mx counterpart.

I am new to github, let me know how do I make these changes to the code in repo if I am allowed to do so.

override protected function adjustSelectionAndCaretUponNavigation(event:KeyboardEvent):void
{
super.adjustSelectionAndCaretUponNavigation(event);

    var navigationUnit:uint = mapKeycodeForLayoutDirection(event);
    if (navigationUnit == Keyboard.LEFT && selectedItem)
    {
        var parent:Object = _dataProvider.getItemParent(selectedItem);
        if ( _dataProvider.isOpen(selectedItem) ) {
            expandItem(selectedItem, false);
        }else if (parent) {
            selectedItem = parent;
        }
    }
    else if (navigationUnit == Keyboard.RIGHT && selectedItem)
    {
        expandItem(selectedItem);
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.